ShellRS
ShellRS is a free, open-source SSH client written in Rust: host management, terminals, WinSCP-style SFTP and port forwarding in one GPU-rendered window, for macOS, Windows and Linux.
Document and test Astro UI components with Storybook
AI summary · website content
Developer toolsTypeScript · JavaScriptGitHub @storybook-astroOnlineOwner unconfirmed
Have you tried it? One tap is enough. No sign-in needed.
No updates detected yet. GitHub releases will appear here.
Owners of public repositories under a personal GitHub account can sign in to verify ownership and manage the introduction themselves. No administrator approval is needed.
Sign in, generate a verification file, and commit it to this repository’s default branch within 30 minutes. Files on other branches or forks do not count. Then check the file below to manage the project without administrator approval. Keep the file to retain your access.
If needed, you will go to sign-in. After signing in, return here and press your chosen verification button again.
Run /nomorevibe verify in your project folder to verify ownership and manage the introduction yourself.
Verify in one minuteAsk about other verification options
The maker's introduction consists of the line above. Read the repository README for more details. Repository README ↗
Loading the full README.
Read the full README ↗The community-supported Storybook framework for Astro. Build, test, and document your Astro components in Storybook's interactive environment.
Website: storybook-astro.org · npm: @storybook-astro/framework · GitHub: storybook-astro
Add Storybook to an existing Astro project.
npm install -D storybook @storybook/builder-vite @storybook-astro/framework
The
@storybook-astro/rendererpackage is installed automatically as a dependency of@storybook-astro/framework— no separate install is needed.
If you'll add framework integrations, install each one's Astro integration and Storybook renderer too. They are optional peer dependencies, so npm doesn't install them for you, and storybook build fails without them. For React:
npm install -D @astrojs/react @storybook/react @vitejs/plugin-react react react-dom
See Installation for the packages each integration needs.
Create .storybook/main.js:
export default {
stories: ['../src/**/*.stories.@(js|jsx|ts|tsx)'],
framework: {
name: '@storybook-astro/framework',
options: {},
},
};
Create .storybook/preview.js:
const preview = {
parameters: {
controls: {
matchers: {
color: /(background|color)$/i,
date: /Date$/i,
},
},
},
};
export default preview;
Add scripts to package.json:
"scripts": {
"dev": "storybook dev -p 6006",
"build": "storybook build"
}
// Card.stories.jsx
import Card from './Card.astro';
export default {
title: 'Components/Card',
component: Card,
};
export const Default = {
args: {
title: 'My Card Title',
content: 'Card content goes here',
},
};
export const Highlighted = {
args: {
title: 'Featured Card',
content: 'This card is highlighted',
highlight: true,
},
};
npm run dev
Note:
npm create storybook@latestdoes not yet recognize Astro as a framework. Use the manual setup above instead.
All options below are passed under framework.options in .storybook/main.js. See the Configuration Reference for the full list.
To use non-Astro framework components (React, Vue, Svelte, etc.) inside your stories, add integrations:
import { react, vue, svelte, preact, solid, alpinejs } from '@storybook-astro/framework/integrations';
export default {
framework: {
name: '@storybook-astro/framework',
options: {
integrations: [
react({ include: ['**/react/**'] }),
vue(),
svelte(),
preact({ include: ['**/preact/**'] }),
solid({ include: ['**/solid/**'] }),
alpinejs({ entrypoint: './.storybook/alpine-entrypoint.js' }),
],
},
},
};
Note:
includepatterns use recursive globs (**) to match components in nested directories (e.g.solid/Counter/Counter.tsx). A non-recursive glob like**/solid/*would fail to match files in subdirectories.
storybook build supports two Astro render modes:
static (default): pre-renders Astro stories into astro-prerendered-stories.json and serves without a render serverserver: builds storybook-static and a standalone Astro render server in storybook-serverexport default {
framework: {
name: '@storybook-astro/framework',
options: {
renderMode: 'server',
server: {
serverUrl: 'https://storybook-render.example.com',
authToken: process.env.STORYBOOK_ASTRO_SERVER_TOKEN,
authHeader: 'authorization',
},
},
},
};
For token-based auth in server mode, you can also use runtime env/global values: STORYBOOK_ASTRO_SERVER_URL, STORYBOOK_ASTRO_SERVER_TOKEN, and STORYBOOK_ASTRO_SERVER_AUTH_HEADER.
Story args and slots are sanitized before they reach the Astro Container, using conservative HTML defaults. By default only slots are sanitized (slots: ['**']); args are left untouched unless you opt specific paths in.
export default {
framework: {
name: '@storybook-astro/framework',
options: {
sanitization: {
// opt specific arg paths into sanitization
args: ['content', 'items.*.description'],
// sanitize all slots (the default)
slots: ['**'],
},
},
},
};
To turn sanitization off entirely, set sanitization: { enabled: false }. See the Sanitization guide for details.
Per-story rules let you run setup and replace modules for matching stories. For HTTP mocking with MSW, install msw in your project and wire it up inside the rules file:
export default {
framework: {
name: '@storybook-astro/framework',
options: {
storyRules: '.storybook/story-rules.ts',
},
},
};
// .storybook/story-rules.ts
import { HttpResponse, http } from 'msw';
import { setupServer } from 'msw/node';
import { defineStoryRules } from '@storybook-astro/framework/node';
const server = setupServer();
let isListening = false;
function getMswServer() {
if (!isListening) {
server.listen({ onUnhandledRequest: 'bypass' });
isListening = true;
}
return server;
}
export default defineStoryRules({
rules: [
{
match: 'components-profile-card--*',
use: ({ mock }) => {
const server = getMswServer();
server.use(
http.get('/api/user', () => {
return HttpResponse.json({ name: 'Storybook User' });
})
);
mock('~/lib/feature-flags', './mocks/feature-flags.ts');
return () => {
server.resetHandlers();
};
},
},
],
});
composeStories and Vitest setupThis tracks Astro's built-in framework features and their compatibility status.
<style> blocks, compiled and scoped by your installed Astro versionclient:load, client:only, etc. for framework componentsstorybook build with build-time pre-rendering of Astro component storiesastro:assets (Image Optimization) — works in components but requires a fallback approach for stories due to module resolution. Components can accept both ImageMetadata and string URLs to maintain compatibility.astro.config.* are resolved through their providers and loaded as @font-face CSS. The runtime exports (fontData, experimental_getFontFileURL) are still stubs, and preload links and fallback metrics aren't generated. See the roadmap.Any help is highly appreciated! Contributions are welcome. See AGENTS.md for guidance on AI-assisted development and deeper architecture notes.
This repository is a Yarn workspaces monorepo. To develop against it locally:
Clone the repository:
git clone https://github.com/storybook-astro/storybook-astro.git
cd storybook-astro
Install dependencies (requires Node 20.16.0+, 22.19.0+, or 24.0.0+):
yarn install
Run Storybook from an integration example:
yarn workspace @storybook-astro/integration-astro6 dev
Build a static Storybook:
yarn workspace @storybook-astro/integration-astro6 build
Serve the built output:
yarn workspace @storybook-astro/integration-astro6 serve
Run tests (validates component rendering and framework integration health):
yarn test
storybook-astro/
├── packages/
│ └── @storybook-astro/
│ ├── framework/ # Framework package
│ │ ├── src/
│ │ │ ├── integrations/ # Framework integrations
│ │ │ ├── middleware.ts # SSR handler + createAstro compat
│ │ │ ├── preset.ts # Storybook config
│ │ │ ├── portable-stories.ts # composeStories for testing
│ │ │ ├── testing.ts # Testing runtime APIs (composeStories, renderStory)
│ │ │ ├── vitest/ # Vitest config helpers (defineConfig)
│ │ │ ├── vitePluginAstroComponentMarker.ts # Astro component detection (5–7)
│ │ │ ├── vitePluginAstroBuildPrerender.ts # Build-time pre-rendering
│ │ │ ├── vitePluginAstroFonts.ts # Astro Font Provider resolution
│ │ │ ├── viteStorybookAstroMiddlewarePlugin.ts # Render request handling (dev)
│ │ │ └── viteStorybookRendererFallbackPlugin.ts
│ │ └── package.json
│ └── renderer/ # Client renderer
│ ├── src/
│ │ ├── render.tsx # Rendering logic + framework delegation
│ │ └── preset.ts # Preview setup
│ └── package.json
├── lib/
│ └── vitest-setup.ts # Vitest setup file
├── src/
│ └── components/ # Example components
├── vitest.config.ts # Test configuration
├── .storybook/ # Storybook configuration
└── package.json # Root package
The project ships two packages:
@storybook-astro/framework (server)Integrates Astro with Storybook's build system: configures Vite to handle .astro files, sets up an Astro Container that renders components server-side on demand, manages UI framework renderers, and handles module resolution for Astro's runtime.
@storybook-astro/renderer (client)Runs inside Storybook's preview iframe: detects component types, sends render requests to the framework middleware over Vite's HMR channel, injects the returned HTML into the canvas, applies scoped styles, and executes client scripts. For non-Astro framework components it delegates to the framework-specific renderer.
Dev mode (storybook dev): the renderer detects Astro components via the isAstroComponentFactory flag, sends a render request to the dev-server middleware over HMR, and the middleware renders the component with the Container API. The returned HTML is injected into the canvas and client scripts run for hydration. Non-Astro framework components are delegated to their framework renderer before storyFn() is called, which avoids orphaned reactive effects.
Static build (storybook build): because Astro components require server-side rendering, the build pre-renders each story at build time using an internal Vite SSR server with the Container API. The pre-rendered HTML is attached to each story export and the client runtime uses it directly. As a result, changing Astro story args via the Controls panel has no effect in static builds (framework component stories remain fully interactive).
For the detailed compatibility layers and implementation notes, see AGENTS.md.
See the Roadmap guide for a consolidated view of planned features, improvements, and known limitations.
This project is based on storybook-astro by Sławek Kołodziej, which pioneered the approach of using Astro's Container API to render Astro components within Storybook.
MIT