Skip to content

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>
tsx
import { Button } from '@zeus-web/button/react'

export function ButtonExample() {
  return <Button variant="primary">Deploy changes</Button>
}
vue
<script setup lang="ts">
import { Button } from '@zeus-web/button/vue'
</script>

<template>
  <Button variant="primary">Deploy changes</Button>
</template>

Add ​

bash
zweb add button

Imports ​

Styled registry component:

tsx
import { Button } from '@/components/ui/button'

Primitive React wrapper:

tsx
import { Button } from '@zeus-web/button/react'

Web Component entry:

ts
import '@zeus-web/button/wc/auto'

Props ​

PropTypeDefaultDescription
variantButtonVariant
Values: default, primary, secondary, outline, ghost, danger
defaultVisual style variant.
sizeButtonSize
Values: sm, md, lg, icon
mdButton size.
disabledboolean-Disables user interaction.
loadingboolean-Marks the button as loading and prevents press handling.
ariaLabelstring-Accessible label for icon-only buttons.

Events ​

EventReact propDetailDescription
pressonPressnativeEvent: MouseEventEmitted when the button is clicked and not disabled.

Slots ​

SlotDescription
defaultButton label content.
prefixContent before the label.
suffixContent after the label.

Styling ​

Uses Tailwind: yes

Theme tokens:

  • bg-primary
  • text-primary-foreground
  • border-input
  • ring-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:

  • cn
  • globals

Files:

  • templates/react/button.tsx → components/ui/button.tsx
  • templates/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>
}

Released under the MIT License.