# 3D Button — React Native component for Expo

> A keycap-style button whose lit face sinks into its edge when pressed.

A physical, keycap-style button — a softly lit face on a darker edge that sinks in when pressed, with a light haptic, and springs back. Light, dark or frosted-glass keycaps (auto picks the one that contrasts with your screen) or any colour; three sizes, pill and circle shapes, loading state.

- Docs: https://expokit.in/docs/components/button-3d
- Tier: Free
- Also called: 3D button, pressable 3D button, game button
- Category: 3D
- Platforms: iOS, Android, web
- Expo Go: yes, no development build needed
- npm dependencies: react-native-svg, expo-haptics
- Uses ExpoKit items: kit
- Variants: On Photo, Keypad, Checkout, Keycaps, Materials

## Installation

Run once per project: `npx @expokit/cli@latest init` (shared theme + KitProvider). Then:

```bash
npx @expokit/cli@latest add button-3d
```

The CLI copies the source into your project (you own the code) and installs react-native-svg, expo-haptics.

Import: `import { Button3D } from "@/components/ui/button-3d";`

## Props

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `children` | `ReactNode` | — | Label, a single glyph (circle buttons) or custom content. |
| `onPress` | `() => void` | — | Fires on tap. |
| `appearance` | `"auto" \| "light" \| "dark" \| "glass"` | `"auto"` | Keycap material; auto is light on dark screens and dark on light ones. Glass is for buttons on photos. |
| `color` | `string` | — | A custom face colour instead of a material, e.g. your brand colour. |
| `size` | `"sm" \| "md" \| "lg"` | `"md"` | Height and text size (36 / 46 / 56). |
| `shape` | `"rounded" \| "pill" \| "circle"` | `"rounded"` | Keycap, pill or round icon button. |
| `depth` | `number` | `4 / 5 / 6 by size` | Edge height in points. |
| `icon` | `ReactNode` | — | Shown before the label. |
| `block` | `boolean` | `false` | Stretch to the parent's width. |
| `loading` | `boolean` | `false` | Show a spinner and ignore taps. |
| `disabled` | `boolean` | `false` | Dim the button and ignore taps. |
| `haptics` | `boolean` | `true` | Light haptic tap on press (iOS / Android). |
| `accessibilityLabel` | `string` | — | Label for screen readers (needed for icon-only buttons). |
| `style` | `StyleProp<ViewStyle>` | — | Style for the root (width, margins). |
| `className` | `string` | — | Tailwind classes on the root when using NativeWind or Uniwind. Prefer style for StyleSheet overrides. |

## Behaviour & accessibility

- **Touch**: The face sinks into its edge on press-in and springs back on release. Small sizes pad their hit area to 44pt.
- **Haptics**: A light impact on press-in on iOS and on press on Android, so scrolling past it doesn't buzz. Turn off with haptics={false}.
- **Screen readers**: A button with disabled and busy state. Pass accessibilityLabel for circle keys that show only a glyph.

## FAQ

### How do I make a 3D button in React Native?

Use ExpoKit's 3D Button: run npx @expokit/cli@latest add button-3d in your Expo or React Native project and it copies a ready-made 3D button into your app as plain TypeScript you can edit. It works on iOS, Android and web, and in Expo Go.

### Does 3D Button work in Expo Go?

Yes. 3D Button runs in Expo Go on iOS and Android with no development build — its packages (react-native-svg, expo-haptics) are all included in Expo Go.

### How do I add 3D Button to my Expo app?

Run npx @expokit/cli@latest add button-3d in your project. The CLI copies the component's source into your app and installs react-native-svg, expo-haptics, so the code is yours to change.

### Is 3D Button free?

Yes. 3D Button is free: its full source is on this page and the CLI installs it without an account.

## More

- Live preview, variants and code: https://expokit.in/docs/components/button-3d
- Every ExpoKit component, screen, template and chart: https://expokit.in/llms.txt
- Install commands and props for every free component: https://expokit.in/llms-full.txt
- Pricing: https://expokit.in/pricing
