Overrides
Change the theme for one part of the page, or for one kind of component.
Appearance sets the theme for the whole app. An override changes it inside one element.
Change one part of the page
Put a data attribute on any element. Everything inside that element uses the setting:
| Attribute | Appearance field | Values |
|---|---|---|
data-density | density | tight, compact, default, comfortable, relaxed, spacious |
data-radius | corners | square, subtle, smooth, round, extra-round |
data-shadow | elevation | flat, quiet, soft, standard, strong |
data-borderwidth | stroke | fine, normal, strong |
The other fields apply to the whole app.
Round only the buttons
Set --nx-radius-base on a wrapper. Buttons read that variable, while inputs
and select triggers read --nx-radius-md, so they keep their corners:
The buttons become pills. The input and the select trigger keep the round
value's 12px.
To change one button, put style={pillButtons} on that button instead.
RadiusStyle adds the custom property to the style type, so you don't need
to change React's global types.
Which variable each component reads
| Variable | Read by |
|---|---|
--nx-radius-base | Button, and the start of FilterConditionField |
--nx-radius-md | Input, InputGroup, SelectTrigger, ButtonGroupText |
--nx-radius-base isn't reserved for Button. Anything inside the wrapper that
uses nx:rounded-base picks up the override.
A component that sets its own radius, such as Carousel's arrows, keeps it. For the rest, check the component source.
Nested wrappers
| Inner wrapper | Result |
|---|---|
No data-radius and no override | Inherits the outer override |
Its own --nx-radius-base | Uses its own value |
Its own data-radius | Resets to that value and drops the outer override |
When data-radius and an inline --nx-radius-base style are on the same
element, the inline value wins.
Overrides follow the DOM tree. A popover or menu that renders in a portal sits outside your wrapper, so it doesn't get the override.
Button groups
ButtonGroup squares off the edges where buttons touch. With an override, only the outer corners are rounded. In a group that mixes Buttons with an Input or ButtonGroupText, the two ends can have different corners.