Displays a button or a component that looks like a button.
❯buridan add buttonUse the following to build the Button component.
from components.ui.button import buttonFor manual installation, copy each of the source codes below in their respective locations.
Use the size prop to change the button's size.
Props used: size on button.
Props used: none required — variant="default" is the default.
Props used: variant on button.
Props used: variant on button.
Props used: variant on button.
Props used: variant on button.
Props used: variant on button.
Props used: size="icon" on button.
Add data-icon="inline-start" or data-icon="inline-end" to the icon child for correct spacing.
Props used: data_icon on the icon child.
Props used: class_name="rounded-full" on button.
Render a spinner() inside the button for a loading state, with the same data-icon positioning convention as icons.
Props used: data_icon on the spinner child.
Use button_variants(...) to generate the button's classes as a plain Var, applied to a real rx.el.a. Don't wrap an <a> inside button(...) — the underlying Base UI Button always sets role="button", which overrides the link's semantic role.
Props used: variant, size args on button_variants(...).
button("Click me", variant="outline", size="sm")
Any other prop accepted by the underlying Base UI Button is also passed straight through.
Returns the same classes button(...) would apply, as a plain Var[str] — for styling a non-button element (like a link) to look like a button, without wrapping it in an actual <button>.
rx.el.a(
"Go to docs",
href="/docs",
class_name=button_variants("outline", "sm"),
)