Components
Button
A native HTML button with SwiftUI-inspired styling. Pass ordinary button props and an onClick handler; use type="submit" inside a form.
AdaptedSwiftUI: Button
Example
Requires React 18.2+ or 19 and shared styles. See setup.
Default
Loading preview…
Code
'use client';
import { Button } from '@swiftuijs/ui';
export default function Example() {
return (<Button>Button</Button>);
}Usage and limitations
- Defaults to
type="button"so clicking does not submit a form accidentally. - Supports native keyboard activation,
disabled,aria-*,className, andstyle. - Use a visible action label, or
aria-labelfor an icon-only button. - Choose
buttonStyle="plain","bordered", or"borderedProminent"; the default"automatic"uses the plain appearance. UsebuttonRole="destructive"for a destructive action.
More examples
Interactive
Disabled
API reference
| Prop | Type | Required | Description |
|---|---|---|---|
buttonStyle | 'automatic' | 'plain' | 'bordered' | 'borderedProminent' | No | SwiftUI-inspired appearance. Automatic is a plain contextual action. |
buttonRole | 'destructive' | 'cancel' | No | Destructive actions use the semantic danger color. |
Inherits additional props from IBaseElementComponent<'button'>.