Button
Styled button component built on the zw-button primitive.
@zeus-web/buttonGeneralzweb add buttonGenerated
Playground
Source
Choose the framework entry that matches your application.
html
<script type="module">
import '@zeus-web/button/wc/auto'
</script>
<zw-button variant="primary">Deploy changes</zw-button>1
2
3
4
5
2
3
4
5
tsx
import { Button } from '@zeus-web/button/react'
export function ButtonExample() {
return <Button variant="primary">Deploy changes</Button>
}1
2
3
4
5
2
3
4
5
vue
<script setup lang="ts">
import { Button } from '@zeus-web/button/vue'
</script>
<template>
<Button variant="primary">Deploy changes</Button>
</template>1
2
3
4
5
6
7
2
3
4
5
6
7
Add
bash
zweb add button1
Imports
Styled registry component:
tsx
import { Button } from '@/components/ui/button'1
Primitive React wrapper:
tsx
import { Button } from '@zeus-web/button/react'1
Web Component entry:
ts
import '@zeus-web/button/wc/auto'1
Props
| Prop | Type | Default | Description |
|---|---|---|---|
variant | ButtonVariantValues: default, primary, secondary, outline, ghost, danger | default | Visual style variant. |
size | ButtonSizeValues: sm, md, lg, icon | md | Button size. |
disabled | boolean | - | Disables user interaction. |
loading | boolean | - | Marks the button as loading and prevents press handling. |
ariaLabel | string | - | Accessible label for icon-only buttons. |
Events
| Event | React prop | Detail | Description |
|---|---|---|---|
press | onPress | nativeEvent: MouseEvent | Emitted when the button is clicked and not disabled. |
Slots
| Slot | Description |
|---|---|
default | Button label content. |
prefix | Content before the label. |
suffix | Content after the label. |
Styling
Uses Tailwind: yes
Theme tokens:
bg-primarytext-primary-foregroundborder-inputring-ring
Internal selectors:
[&_[data-slot=button]][&_[data-slot=button-prefix]][&_[data-slot=button-suffix]]
Registry
Registry source: available.
Add command: zweb add button
Type: component
Dependencies:
@zeus-web/button
Registry dependencies:
cnglobals
Files:
templates/react/button.tsx→components/ui/button.tsxtemplates/vue/button.vue→components/ui/button.vue
AI usage rules
Do:
- Use Button for actions.
- Use variant="outline" for secondary actions.
- Use size="icon" only for icon-only buttons.
Do not:
- Do not add asChild; the current registry Button does not implement asChild.
- Do not attach click handlers to internal button selectors manually.
Examples
React styled usage
tsx
import { Button } from '@/components/ui/button'
export function Example() {
return <Button variant="primary">Save</Button>
}1
2
3
4
5
2
3
4
5