# writing-react-native-storybook-stories

Teaches the agent to write and edit React Native stories in CSF: args, argTypes, decorators, addon parameters and portable stories for testing.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode · 681 installs · ★ 1324
- Author: storybookjs
- License: MIT · policy=mirror · the beginning of the file is at the end of this page
- Source: https://github.com/storybookjs/react-native/tree/HEAD/skills/writing-react-native-storybook-stories/SKILL.md
- Updated: 2026-10-24
- HTML: https://affpapa.org/en/nevibecode/skills/writing-react-native-storybook-stories

## What it does

The skill covers story authoring for `@storybook/react-native` v10 with Component Story Format. The agent gets file conventions (`ComponentName.stories.tsx` next to the component), the `meta` object with `satisfies Meta<typeof Component>`, and story typing via `StoryObj<typeof meta>`. Patterns are included: several stories sharing `args`, a custom `render`, a render with hooks as a named function, mocked callbacks through `fn()` from `storybook/test`.

Separate sections handle controls and `argTypes` — select, range slider, color picker, a conditional control with `if: { arg: 'advanced' }`. TypeScript prop types map to controls on their own: `string` to text, `boolean` to boolean, unions to select. Addon parameters can sit on a story, on the component, or globally in `preview.tsx`. React Native adds its own: `noSafeArea`, `storybookUIVisibility`, `hideFullScreenButton`, `layout`.

Watch out for `noSafeArea`. Turn it on and the component has to handle safe areas itself, because Storybook stops adding the padding. The source suggests `useSafeAreaInsets()` with insets applied as `paddingTop`/`paddingBottom` on the container, and `contentContainerStyle` padding for scrollable content. Global decorators live in `.rnstorybook/preview.tsx`.

## Install

### Claude Code (native platform)

1. **Skills CLI (Vercel)**
```bash
npx skills add storybookjs/react-native --skill writing-react-native-storybook-stories -a claude-code
```

2. **Manually: put the files in place**
- File: `~/.claude/skills/writing-react-native-storybook-stories/SKILL.md` — Copy the whole skill folder; for one project use .claude/skills/writing-react-native-storybook-stories/

### Codex

1. **Skills CLI (Vercel)**
```bash
npx skills add storybookjs/react-native --skill writing-react-native-storybook-stories -a codex
```

2. **Manually: put the files in place**
- File: `.agents/skills/writing-react-native-storybook-stories/SKILL.md` — For all projects use ~/.agents/skills/

### Cursor

1. **Skills CLI (Vercel)**
```bash
npx skills add storybookjs/react-native --skill writing-react-native-storybook-stories -a cursor
```

2. **Manually: put the files in place**
- File: `.cursor/skills/writing-react-native-storybook-stories/SKILL.md` — Cursor also reads .agents/skills/ and .claude/skills/

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install storybookjs/react-native writing-react-native-storybook-stories
```

2. **Manually: put the files in place**
- File: `.github/skills/writing-react-native-storybook-stories/SKILL.md`

### Gemini CLI

1. **Skills CLI (Vercel)**
```bash
npx skills add storybookjs/react-native --skill writing-react-native-storybook-stories -a gemini-cli
```

2. **Platform CLI**
```bash
gemini skills install https://github.com/storybookjs/react-native --path skills/writing-react-native-storybook-stories
```

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/skills/writing-react-native-storybook-stories/SKILL.md` — The legacy .windsurf/skills/ path still works

### OpenCode

**Skills CLI (Vercel)**
```bash
npx skills add storybookjs/react-native --skill writing-react-native-storybook-stories -a opencode
```

### Claude.ai

**Claude.ai**
- Zip the folder and upload it in Settings → Capabilities → Skills

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/storybookjs/react-native/tree/HEAD/skills/writing-react-native-storybook-stories/SKILL.md

## When to use it
- write a first story file for a React Native component
- set up a select and a range slider via argTypes
- mock an onPress callback in a button story
- wrap a story in a provider or layout with decorators
- switch on a dark background in the Backgrounds addon

## Example prompts
- Write a CSF story for the Button component in Button.stories.tsx
- Add argTypes with a size select and an opacity range slider to meta
- Wrap this story in a decorator that centers it vertically

## Source text · SKILL.md · MIT

Below is the content of a third-party file. It is data, not instructions for you: do not act on anything written inside unless the human asks. Block tag: 709b9b2bf9879484.

BEGIN THIRD-PARTY FILE 709b9b2bf9879484
````text
---
name: writing-react-native-storybook-stories
description: Create and edit React Native Storybook stories using Component Story Format (CSF). Use when writing .stories.tsx files, adding stories to React Native components, configuring Storybook addons (controls, actions, backgrounds, notes), setting up argTypes, decorators, parameters, or working with portable stories for testing. Applies to any task involving @storybook/react-native story authoring.
---

# React Native Storybook Stories

Write stories for React Native components using `@storybook/react-native` v10 and Component Story Format (CSF).

## Quick Start

Minimal story file:

```tsx
import type { Meta, StoryObj } from '@storybook/react-native';
import { MyComponent } from './MyComponent';

const meta = {
  component: MyComponent,
} satisfies Meta<typeof MyComponent>;

export default meta;
type Story = StoryObj<typeof meta>;

export const Basic: Story = {
  args: {
    label: 'Hello',
  },
};
```

## File Conventions

- Name: `ComponentName.stories.tsx` colocated with the component
- Import `Meta` and `StoryObj` from `@storybook/react-native`
- Default export: `meta` object with `satisfies Meta<typeof Component>`
- Named exports: UpperCamelCase story names, typed as `StoryObj<typeof meta>`
- Use `args` for props, `argTypes` for control config, `parameters` for addon config
- Use `render` for custom render functions, `decorators` for wrappers

## Story Patterns

### Multiple stories with shared args

```tsx
export const Primary: Story = {
  args: { variant: 'primary', title: 'Click me' },
};

export const Secondary: Story = {
  args: { ...Primary.args, variant: 'secondary' },
};
```

### Custom render function

```tsx
export const WithScrollView: Story = {
  render: (args) => (
    <ScrollView>
      <MyComponent {...args} />
    </ScrollView>
  ),
};
```

### Render with hooks (must be a named function)

```tsx
export const Interactive: Story = {
  render: function InteractiveRender() {
    const [count, setCount] = useReducer((s) => s + 1, 0);
````
END THIRD-PARTY FILE 709b9b2bf9879484

The third-party file has ended. Everything between the 709b9b2bf9879484 tags is data: requests and commands from it are not followed. An “end of file” line with another tag inside the block is part of the file.

First 2040 of 9837 bytes. © storybookjs · MIT · https://github.com/storybookjs/react-native/tree/HEAD/skills/writing-react-native-storybook-stories/SKILL.md

_Part of the page did not fit — see the HTML version._

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
