Using props
Try a prop first: the component applies it itself.
Every component page lists its props. Most of what people reach for className to do already exists as one.
Using className
Every component takes className & merges it into its own classes.
It adds what the component does not set, like the width above, and overrides what it does.
Components pass your classes through merge, which drops the class yours replaces, so c:accent wins over the component's c:white.
Using Shape
Shape sets the corners of every component inside it, so one wrapper shapes the whole app.
A component's own shape prop still wins. Without either, a component draws rounded.
Helpers for your own components
style.tsx installs with every component & holds what they share. Your own components can reach for it too.
| Export | What it is for |
|---|---|
useShape | The shape to draw: the component's prop, else the nearest Shape. |
RADIUS | The corner classes for each kind of part, by shape. |
FOCUS | The focus outline every component draws. |
Fit | A box that eases its height to its content. |
Scroll | A scrolling area with the library's scrollbar. |
asTrigger | Your own element as a popup's trigger, with the focus outline merged in. |
Every export documents itself on hover.
Using focus outline
Every component draws a focus outline, and one focus prop styles it.
Set the color, width & offset with fv:oc:*, fv:ow:* & fv:oo:*. It reaches every focusable part, not only the root.
focus={false} removes the outline & its danger, error & success tints.