shadcn/ui
The shadcn/ui approach: 29 components on Radix and Tailwind are placed in the project and belong to it, a theme on CSS variables in a light and a dark scheme, cn(), components.json. Norms: components in one folder, colors only from the theme, a complete theme, a valid config.
О пакете
Этот текст ещё не переведён. Ниже английский оригинал.
The shadcn/ui approach for a project on React and Tailwind 4: component sources live in the project and belong to it, and the look is held by a theme of CSS variables. What this approach is in our own words, what is placed and how to add a component is on the page shadcn/ui.
What it installs
- The page shadcn/ui: a guide, the list of the project's components (
components:), where@/points (aliasRoot:). - A theme showcase: buttons, fields, a card, tabs, badges, alerts in the light and dark schemes, and the contrast of color pairs.
- The
placeaction (runs by itself after install and update): components go to theuifolder fromcomponents.json,cn()toutils, the theme totailwind.css, andcomponents.jsonif there is none; hashes go to.shadcn.json. It does not overwrite edited files. - The registry: 29 shadcn/ui components (style
new-york-v4),cn(), the "neutral" theme for Tailwind 4, and the defaultcomponents.json, in.shtukbase/packages/shadcn/registry/with the MIT license and a note of the source. - Norms:
- SHD-R01:
components.jsonis valid; theconfigcheck. - SHD-R02: components in one folder, Radix primitives only there; the
foldercheck. - SHD-R03: colors only from the theme: no Tailwind palette and no custom colors in components; the
colorscheck. - SHD-R04: the theme has a light and a dark scheme and all required variables; the
themecheck.
- SHD-R01:
Where the boundary is
- The package does not install npm dependencies and does not build code: the needed packages (
react,radix-ui,cva,cn,lucide-react,tailwindcss4,tw-animate-css) are printed byplaceas a list. - The registry has 29 components; blocks, charts, a calendar and a sidebar are not included. The rest is added with the ordinary shadcn CLI; they share
components.json. - Theme contrast is a norm of the
design-a11ypackage, spacing and font scales belong todesign-scales. tools/vendor.tsis for whoever maintains the package: it re-reads the components from the open shadcn registry. Installation does not run it.
Source: shadcn/ui, https://ui.shadcn.com, MIT © 2023 shadcn; read on 28.11.2026.
Нормы 4
| ID | Норма | Уровень | Режим | Enforcer |
|---|---|---|---|---|
| SHD-R01 | components.json в корне проекта — объект JSON с полями, которые читает shadcn, нужных типов; файл темы из tailwind.css есть; псевдонимы ui и utils ведут к папке и файлу. |
MUST | не пускает | проверка |
| SHD-R02 | Компоненты интерфейса лежат в одной папке — псевдоним ui из components.json: все положенные компоненты на месте; вне её файлы не объявляют компонентов (data-slot) и не импортируют примитивы Radix. |
MUST | не пускает | проверка |
| SHD-R03 | В компонентах и экранах продукта цвет берётся только из переменных темы: нет цветов палитры Tailwind (bg-red-500), своих цветов (bg-[#fff], style={{ color: "#333" }}, fill="#000") и сырых цветов в правилах CSS. |
MUST | не пускает | проверка |
| SHD-R04 | Тема в CSS проекта задаёт в :root --radius и все обязательные цвета shadcn, а тёмная схема (.dark) задаёт все обязательные цвета заново; каждый цвет — цвет. |
MUST | не пускает | проверка |
«Не пускает» — enforcer останавливает нарушение; «наблюдает» — только отмечает его. Уровень MUST — обязательно, SHOULD — по умолчанию да.
Действия 5
| Имя | Что делает | Файл | Когда |
|---|---|---|---|
| place | Place components in the project (the list is on /design/shadcn.md; names in the arguments add more; --force replaces edited ones) | actions/place.ts | после установки после обновления |
| config | components.json is valid норма SHD-R01 | checks/config.ts | проверка |
| folder | Components in one folder, Radix only there норма SHD-R02 | checks/folder.ts | проверка |
| colors | Colors only from the theme норма SHD-R03 | checks/colors.ts | проверка |
| theme | The theme has both schemes and all required variables норма SHD-R04 | checks/theme.ts | проверка |
Проверки запускает shtuk check, любое действие — shtuk run shadcn <имя>. Действия «после установки» запускаются сами, только если пакет из доверенного источника.
Страницы 6
Ложатся в проект по этим путям.
- /design/
- shadcn/ui страница
- /design/shadcn/
- showcase.html файл
- /norms/rules/shadcn/
- components.json валиден SHD-R01
- Компоненты в одной папке SHD-R02
- Цвета только из темы SHD-R03
- В теме обе схемы и все обязательные переменные SHD-R04
Файлы пакета 43
Ложатся в .shtukbase/packages/shadcn/; отсюда запускаются действия.