# IconButton

Accessible icon-only action button built on the shared Button seam.

[All components](https://rickylabs.github.io/netscript/design-system/components/) · [Theme builder](https://rickylabs.github.io/netscript/create/) · [Implementation source](https://github.com/rickylabs/netscript/blob/main/packages/fresh-ui/registry/components/ui/icon-button.tsx)

## Live preview

[Open live icon-button preview](https://rickylabs.github.io/netscript/assets/fresh-ui/preview/?component=icon-button&theme=studio-utility)

## Install

```bash
netscript ui:add icon-button
```

## Usage and examples

The preview runs this JSX with the installed components. Import any composed primitives from your UI directory.

```tsx
import { useState } from 'preact/hooks';
import { IconButton } from '@app/components/ui/icon-button.tsx';

export function Example() {
  const [value, setValue] = useState('standard');
  const [open, setOpen] = useState(false);
  const [notice, report] = useState('');
  return (<><div><IconButton icon="+" label="Create order" onClick={() => report("Order created")} /></div><p role="status">{notice}</p></>);
}
```

## Props

Generated from native `deno doc --json --private` over the shipped implementation. Compound component props retain their owning interface; native attributes pass through where declared.

| Owner | Prop | Type | Optional | Description |
| --- | --- | --- | --- | --- |
| `SharedIconButtonProps` | `class` | `string` | Yes |  |
| `SharedIconButtonProps` | `disabled` | `boolean` | Yes |  |
| `SharedIconButtonProps` | `icon` | `Renderable` | No |  |
| `SharedIconButtonProps` | `label` | `string` | No |  |
| `SharedIconButtonProps` | `loading` | `boolean` | Yes |  |
| `SharedIconButtonProps` | `variant` | `ButtonVariant` | Yes |  |
| `IconButtonAsButtonProps` | `type` | `IconButtonElementType` | Yes |  |
| `IconButtonAsButtonProps` | `href` | `never` | Yes |  |
| `IconButtonAsButtonProps` | `clientNav` | `never` | Yes |  |
| `IconButtonAsLinkProps` | `type` | `"link"` | No |  |
| `IconButtonAsLinkProps` | `href` | `string` | No |  |
| `IconButtonAsLinkProps` | `clientNav` | `boolean` | Yes |  |

## Keyboard

| Key | Action |
| --- | --- |
| `Enter` | Activate |
| `Space` | Activate button; links use native Enter |

## Tokens

Semantic contract roles: `border/default`, `border/hover`, `border/width`, `destructive/default`, `destructive/fg`, `destructive/hover`, `primary/default`, `primary/fg`, `primary/hover`, `radius/control`, `secondary/border`, `secondary/default`, `secondary/fg`, `text/fg`, `text/muted`.

CSS custom properties referenced directly: Composed primitives supply their own tokens.

## Contract and compatibility

Accessibility pattern: [WAI-ARIA guidance](https://www.w3.org/WAI/ARIA/apg/patterns/button/)

- Native DOM attributes pass through where the implementation accepts them.

Design contract values marked planned are not implementation props. The props above describe what ships today.
