# Button preview

Interactive preview of the CyberSpec Button component. A cut-corner button with a raised tab, five tones, and a press flash. Enable the cipher prop to scramble the label and briefly tear the frame on hover.

[View Button preview on CyberSpec](https://www.cyberspec.dev/preview/button)

## About this preview

Button belongs to the Actions group in the CyberSpec catalog. It uses @ui-sdk/react/button.

## Installation

Use a React 19 project with shadcn configured. Render the installed components inside the Cyber root, and import your global stylesheet in the app entry point.

```sh
bunx --bun shadcn@latest add https://www.cyberspec.dev/r/button.json
```

## Example

```tsx
"use client"

import { Crosshair } from "lucide-react"
import { Button } from "@/components/ui/button"

const wait = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms))

export default function ButtonDemo() {
  return (
    <>
      <Button tone="primary">Deploy</Button>
      <Button>Abort</Button>
      <Button tone="signal" cipher onClick={() => wait(1400)} pendingAnnouncement="Scanning">
        Scan
      </Button>
      <Button tone="flag">Accept</Button>
      <Button icon aria-label="Lock on">
        <Crosshair aria-hidden />
      </Button>
      <Button disabled>Offline</Button>
      <Button cipher>Cipher button</Button>
    </>
  )
}
```

## Install this example

```sh
bunx --bun shadcn@latest add https://www.cyberspec.dev/r/button-demo.json
```

## Resources

- [Button documentation](https://www.cyberspec.dev/components/sidebar/button.md)
- [Component catalog](https://www.cyberspec.dev/components.md)
- [Button source code](https://github.com/agnelnieves/cyberspec/blob/main/registry/cyber/ui/button.tsx)
- [Shadcn registry item](https://www.cyberspec.dev/r/button.json)
