Button
Native Solid 2 fork. Original documentation and designs © WorkOS; historical posts retain their original context.
API Reference
This component is based on the button element and supports common margin props.
Examples
Size
Use the size prop to control the size of the button.
Variant
Use the variant prop to control the visual style of the button.
Ghost
Use the ghost variant to display a button without chrome. Ghost buttons behave like text in layout, as they use a negative margin to optically align themselves against their siblings while maintaining the padding in active and hover states.
Color
Use the color prop to assign a specific color.
High-contrast
Use the highContrast prop to increase color contrast with the background.
Radius
Use the radius prop to assign a specific radius value.
With icons
You can nest icons directly inside the button. An appropriate gap is provided automatically.
Loading
Use the loading prop to display a loading spinner in place of button content, preserving the original size of the button in its normal state. The button will be disabled while loading.
If you have an icon inside the button, you can use the button’s disabled state and wrap the icon in a standalone Spinner to achieve a more sophisticated design.