Styling
RadixNG are unstyled and compatible with any styling solution giving you complete control over styling.
Overview
Classes
All components accept class attributes, just like regular Angular component. This class will be passed to the host:
.
For some primitives
based on @Components
, the className
property is used and applied to the child element of the component.
Data attributes
When components are stateful, their state will be exposed in a data-state
attribute.
For example, when an Accordion Item is opened, it includes a data-state="open"
attribute.
Styling with CSS
Styling a part
You can style a component part by targeting the class
that you provide.
Styling a state
You can style a component state by targeting its data-state
attribute.
Styling with Tailwind CSS
The examples below are using Tailwind CSS, but you can use any library of your choice.
Styling a part
You can style a component part by targeting the class
.
Styling a state
With Tailwind CSS’s powerful variant selector, you can style a component state by targeting its data-state
attribute.
Extending a primitive
Extending a primitive is done the same way you extend any Angular component.
Host Directive
One of the best ways is to use hostDirectives
.