# Button Styled button with full DaisyUI support and reactive states. ## Tag `Button` ## Props | Prop | Type | Default | Description | | :--- | :--- | :--- | :--- | | `class` | `string` | `''` | Additional CSS classes (DaisyUI + Tailwind) | | `disabled` | `boolean \| Signal` | `false` | Disabled state | | `loading` | `boolean \| Signal` | `false` | Shows loading spinner | | `badge` | `string \| Signal` | `-` | Badge text displayed on corner | | `badgeClass` | `string` | `'badge-secondary'` | Badge styling classes | | `tooltip` | `string \| Signal` | `-` | Tooltip text on hover | | `icon` | `string \| VNode \| Signal` | `-` | Icon displayed before text | | `onclick` | `function` | `-` | Click event handler | | `type` | `string` | `'button'` | Native button type | ## Live Examples ### Basic Button
```javascript Button({ class: "btn-primary" }, "Click Me") ``` ### With Loading State
```javascript const isSaving = $(false); Button({ class: "btn-success", loading: isSaving, onclick: async () => { isSaving(true); await saveData(); isSaving(false); } }, "Save Changes") ``` ### With Badge
```javascript Button({ class: "btn-outline", badge: "3", badgeClass: "badge-accent" }, "Notifications") ``` ### With Tooltip
```javascript Button({ class: "btn-ghost", tooltip: "Delete item" }, "Delete") ``` ### Disabled State
```javascript const isDisabled = $(true); Button({ class: "btn-primary", disabled: isDisabled }, "Submit") ``` ### All Variants
```javascript Div({ class: "flex flex-wrap gap-2" }, [ Button({ class: "btn-primary" }, "Primary"), Button({ class: "btn-secondary" }, "Secondary"), Button({ class: "btn-accent" }, "Accent"), Button({ class: "btn-ghost" }, "Ghost"), Button({ class: "btn-outline" }, "Outline") ]) ``` ```