# IconButton

> Atom — orn-ui

> ⚠️ Requires <UIProvider>: This component (like every orn-ui component) must render inside a <UIProvider> ancestor, or it throws at runtime. See https://orn-ui-docs.vercel.app/getting-started.md

> Runs on Expo SDK 54, 55, 56 and 57, and on bare React Native >=0.81 with react >=19.1. No native modules — works in Expo Go, no prebuild.

## Installation

Install just this component (copies the source into your project, no npm dependency)
```bash
npx orn-ui add icon-button
```

Or install the whole package and import it
```tsx
pnpm add orn-ui
import { IconButton } from 'orn-ui/icon-button';
```

Depends on: core (theme + icons), pressable-scale

## Variants

### close

```tsx
<IconButton iconName="close" accessibilityLabel="Close" onPress={() => {}} />
```

### check

```tsx
<IconButton iconName="check" accessibilityLabel="Confirm" onPress={() => {}} />
```

### search

```tsx
<IconButton iconName="search" accessibilityLabel="Search" onPress={() => {}} />
```

### small

```tsx
<IconButton iconName="check" size={16} accessibilityLabel="Small" onPress={() => {}} />
```

### large

```tsx
<IconButton iconName="check" size={32} accessibilityLabel="Large" onPress={() => {}} />
```

### custom color

```tsx
<IconButton iconName="check" color="#ff3b30" accessibilityLabel="Red" onPress={() => {}} />
```

### disabled

```tsx
<IconButton iconName="close" accessibilityLabel="Disabled" onPress={() => {}} disabled />
```

## Full demo source

```tsx
const variants: VariantDef[] = [
  { label: 'close', content: <IconButton iconName="close" accessibilityLabel="Close" onPress={() => {}} /> },
  { label: 'check', content: <IconButton iconName="check" accessibilityLabel="Confirm" onPress={() => {}} /> },
  { label: 'search', content: <IconButton iconName="search" accessibilityLabel="Search" onPress={() => {}} /> },
  { label: 'small', content: <IconButton iconName="check" size={16} accessibilityLabel="Small" onPress={() => {}} /> },
  { label: 'large', content: <IconButton iconName="check" size={32} accessibilityLabel="Large" onPress={() => {}} /> },
  { label: 'custom color', content: <IconButton iconName="check" color="#ff3b30" accessibilityLabel="Red" onPress={() => {}} /> },
  { label: 'disabled', content: <IconButton iconName="close" accessibilityLabel="Disabled" onPress={() => {}} disabled /> },
];
return <VariantList variants={variants} />;
```

## Props

| Name | Type | Default | Description |
|---|---|---|---|
| `iconName?` | `IconName` | — | — |
| `icon?` | `ReactNode` | — | — |
| `onPress?` | `(e: GestureResponderEvent) => void` | — | — |
| `size?` | `number` | 24 | — |
| `color?` | `string` | — | — |
| `disabled?` | `boolean` | — | — |
| `style?` | `StyleProp<ViewStyle>` | — | — |
| `accessibilityLabel` | `string` | — | — |
