Button
An interactive control that triggers an action when pressed.
Import
import { Button } from '@oztix/roadie-components'
Examples
Default
<Button>Button</Button>
Emphasis
Sizes
Intents
Neutral is the default intent. Each intent communicates a different purpose: accent for primary actions, danger for destructive actions, and so on. Hover and focus states adapt automatically.
States
Hover and focus states use the intent color scale automatically via is-interactive.
Href
Pass href to render the button as a routed anchor. Roadie picks the right element + safety attributes based on the href shape: internal routes go through your configured RoadieLinkProvider; external hrefs (https://…, //…) auto-render with target='_blank' rel='noopener noreferrer'; protocol hrefs (mailto: / tel: / sms:) render plain anchors.
Hover each button — the browser status bar shows the resolved href exactly as Roadie rendered it. See Linking for the full reference: provider setup, the external/internal/protocol decision tree, and the external/target/rel overrides.
Escape hatch
For typed access to anchor-only DOM props (download, hreflang, referrerPolicy) or full element control, use Base UI's render prop. Passing both href and render triggers a one-shot dev warning — render wins, provider routing is silently disabled.
<Button render={<a href='/spec.pdf' download='spec.pdf' />}> Download spec </Button>
Accessibility
- Keyboard:
EnterorSpaceactivates the button. Focus is indicated by a semi-transparent ring viais-interactive. - ARIA: Uses native
<button>element.disabledsetsaria-disabledautomatically. - IconButton: Requires an
aria-labelprop (enforced by TypeScript) since there is no visible text.
API reference
Button
Base UIWhether the button should be focusable when disabled.
Defaults to false.
Pass a URL to render the button as a routed anchor instead of a `<button>`. Internal hrefs route through the configured `RoadieLinkProvider` (or fall back to plain `<a>`); external hrefs (`http(s)://`, `//…`) render as `<a target='_blank' rel='noopener noreferrer'>`; `mailto:` / `tel:` / `sms:` render as plain `<a>`. Pair with `external`, `target`, or `rel` to override the defaults.
Force external-link treatment regardless of `href` shape. Useful for first-party URLs that should still open in a new tab, or for an `https://` URL that should route internally through the provider.
Override the auto `target='_blank'` default on external hrefs.
Inherited from NativeButtonProps
Whether the component renders a native `<button>` element when replacing it via the `render` prop. Set to `false` if the rendered element is not a button (e.g. `<div>`).
Defaults to true.
Inherited from HTMLAttributes
Override the auto `rel='noopener noreferrer'` default on external hrefs.
IconButton
Pass a URL to render the button as a routed anchor instead of a `<button>`. Internal hrefs route through the configured `RoadieLinkProvider` (or fall back to plain `<a>`); external hrefs (`http(s)://`, `//…`) render as `<a target='_blank' rel='noopener noreferrer'>`; `mailto:` / `tel:` / `sms:` render as plain `<a>`. Pair with `external`, `target`, or `rel` to override the defaults.
Force external-link treatment regardless of `href` shape. Useful for first-party URLs that should still open in a new tab, or for an `https://` URL that should route internally through the provider.
Override the auto `target='_blank'` default on external hrefs.
Icon-button sizing. Use `'xs' | 'sm' | 'md' | 'lg'` (plain) — the `'icon-*'` aliases are accepted for backwards compatibility but discouraged.
Defaults to md.
Inherited from HTMLAttributes
Override the auto `rel='noopener noreferrer'` default on external hrefs.
Inherited from ButtonProps
Whether the button should be focusable when disabled.
Defaults to false.
Inherited from NativeButtonProps
Whether the component renders a native `<button>` element when replacing it via the `render` prop. Set to `false` if the rendered element is not a button (e.g. `<div>`).
Defaults to true.