Write Storybook stories in Python - Typings for Storybook's Component Story Format (CSF) v3.
The types defined in this package allow you to write Storybook's CSF format in your Python projects. See included types here.
NOTE: The types defined in this package are a JSON-compatible subset of CSF. Fields that require JS-specific types are not included.
from storybook_csf import ComponentAnnotations, ProjectAnnotations, StoryAnnotations
# This will be typed
data: ComponentAnnotations = {
"title": "Component",
"parameters": {
"options": { "component": "my_widget" }
},
# `stories` field is specific to Storybook for Server
# See https://github.com/storybookjs/storybook/tree/next/code/frameworks/server-webpack5
"stories": [
{
"name": "Default",
"parameters": {
"server": { "id": "path/of/your/story" }
}
}
]
}pip install storybook-csfRead the Release Notes to see the latest features and fixes.
To run tests, use:
pytest