PseudoBox composes Box component and provides props to style common CSS
pseudo selectors.
Styling elements on hover, focus, and more can be accomplished by prefixing _
with the appropriate pseudo selector.
For example, to style &:hover, use the _hover prop and pass the style props.
We use the underscore _ notation to visually separate pseudo style props from
regular style props.
PseudoBox includes first-class support for styling elements on hover, focus,
active, disabled, visited, first-child, last-child, odd-child, even-child,
focus-within, and more.
It was created to help reduce the need to pass css prop or use styled(...)
function to style common pseudo states.
Add the _disabled prop to style an element when it is disabled. This style
will apply when the disabled or aria-disabled attribute of an element is set
to true
Add the _first prefix to style an element when it is the first-child of its
parent. This is mostly useful when elements are being generated in some kind of
loop.
Add the _last prefix to style an element when it is the last-child of its
parent. This is mostly useful when elements are being generated in some kind of
loop.
Add the _odd prop to style an element when it is the odd-child of its parent.
This is mostly useful when elements are being generated in some kind of loop.
Add the _even prop to style an element when it is the even-child of its
parent. This is mostly useful when elements are being generated in some kind of
loop.
If you need to style a child element when hovering over a specific parent
element, add the role="group" attribute to the parent element, then you can
use _groupHover prop to style the child element.
New Project
Create a new project from a variety of starting templates.
PseudoBox can be used to style any interactive component. You can apply styles
to the following selectors. The selectors are also ARIA-friendly to help you
naturally use aria attributes for better accessibility.