Ouro HX names the parts of its most-styled components with a data-slot attribute, the names shadcn/ui gives its own parts, so a stylesheet that is written in plain CSS, code ported from shadcn/ui and a test can reach a part by a name that stays put.shadcn-names
The named components
Every styled element of these components carries a name: Alert, Badge, Button, Card, Checkbox, Dialog, Field (its label, control and description), Popover, Select, Separator, Sheet, Switch, Tabs, TextField and Tooltip.named Their names are a contract: a release that renames one says so in UPGRADING.md.
The other components are not named yet. scripts/part-names-baseline.json counts each one's styled elements with no name, and that count may only shrink.ratchet A component joins the named list when its count reaches zero.ratchet
The naming rule
- A part is named as shadcn/ui names the same part:
dialog-title,card-header,sheet-content,select-trigger. Where shadcn's name is for a different element, Ouro's part takes shadcn's name for the same thing:inputis TextField's control andlabelis Field's label.alias - A part Ouro has and shadcn does not is named for its component and the part:
alert-body,card-rise,dialog-scroller. - A component's root carries the component's name, as
buttonandcarddo.roots Dialog, Popover, Select, Sheet and Tooltip name their popup<component>-content, as shadcn names it.popups A Field's root is named for its owner:text-field,checkbox.alias - Names are kebab case, and a component's own parts start with its name.scan
A parent can rename a part by passing its own data-slot. Ouro writes the name before the props it spreads, so the parent's name wins: <Button data-slot="save-button"> renders save-button, not button.parent-wins
Style a part from plain CSS
Write the rules in your own stylesheet, outside any @layer. A rule outside every layer wins over a layered one whatever its specificity, so the component's own utilities need no override.unlayered
[data-slot="alert"] {
border-style: dashed;
}
[data-slot="card-title"] {
letter-spacing: 0.01em;
}
[data-slot="dialog-content"] [data-slot="dialog-title"] {
font-family: var(--font-heading);
}Read colours, radii and fonts from the theme's variables (var(--primary), var(--radius)), as the components do, so your rules follow light and dark and the app's theme.
Select by the name, not by the element, its place in the tree or its Tailwind classes: those may change in any release, and the name does not.
Beside shadcn/ui components
Ouro uses shadcn's attribute, and some names are the same as shadcn's (card, button, dialog-title). So in an app with both, a rule written for a shadcn part also styles the Ouro part of that name. To keep a rule to one library, select Ouro's component by its data-ouro value: [data-ouro="card"] is Ouro's Card, and [data-slot="card"]:not([data-ouro]) is shadcn's.roots
For contributors
A styled element in a named component needs a literal data-slot, written before any {...props} spread. node scripts/part-names.mts lists the elements with no name, and scripts/part-names.test.mjs fails on them, on a name that is not kebab case or does not start with its component's name, and on a count in the baseline that rose or fell.scanratchet node scripts/part-names.mts --write lowers the baseline's counts to the current ones once a component's names have landed.ratchet
Claim sources
- shadcn-names: The page at github.com
Checks
- The page it cites opens
- A test with this name exists: the named components carry the shadcn names their roots and parts use, and an Ouro-only part starts with its stem
- named: The source file part-names-baseline.json
Checks
- A test with this name exists: every element a named component styles carries a part name, and the other components hold their ratchet
- ratchet: The source file part-names-baseline.json
Checks
- A test with this name exists: the ratchet fails when a component's unnamed count rises or falls, and writes the count back when it falls
- A test with this name exists: every element a named component styles carries a part name, and the other components hold their ratchet
- scan: The test that proves it: the part-name scan fails a named component's unnamed element, a name that is not a literal, not kebab case, not its stem's, or after a spread
Checks
- A test with this name exists: the part-name scan fails a named component's unnamed element, a name that is not a literal, not kebab case, not its stem's, or after a spread
- popups: The test that proves it: the named components carry the shadcn names their roots and parts use, and an Ouro-only part starts with its stem
Checks
- A test with this name exists: the named components carry the shadcn names their roots and parts use, and an Ouro-only part starts with its stem
- roots: The test that proves it: part names > name the roots and parts of Button, Card, Badge and Alert as shadcn names them
Checks
- A test with this name exists: part names > name the roots and parts of Button, Card, Badge and Alert as shadcn names them
- alias: The test that proves it: part names > name a TextField's input and label, and a Checkbox's box and indicator, as shadcn names them
Checks
- A test with this name exists: part names > name a TextField's input and label, and a Checkbox's box and indicator, as shadcn names them
- parent-wins: The test that proves it: part names > keep a name a parent passes, so an app can rename a part of a component
Checks
- A test with this name exists: part names > keep a name a parent passes, so an app can rename a part of a component
- unlayered: The test that proves it: part names > let an app's plain CSS, outside any layer, restyle a named part over the component's own utilities
Checks
- A test with this name exists: part names > let an app's plain CSS, outside any layer, restyle a named part over the component's own utilities

