storybook-addon-rtl
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

Storybook Addon RTL Version

Storybook Addon RTL allows you to switch to right-to-left flow in your stories in Storybook.

This addon has been tested with Storybook for React, Vue and Angular. It should also work in other frameworks.

Storybook Addon RTL Demo

This is a permanent fork of unindented/storybook-addon-rtl, which is now archived. Thanks for unindented for the original code!

Getting Started

npm i --save-dev storybook-addon-rtl

Add the addon to the addons array in .storybook/main.js

module.exports = {
  /// other storybook configuration
  addons: [
    // other addons here
    "storybook-addon-rtl",
  ],
};

Then write your stories normally:

import React from 'react'
import MyComponent from './MyComponent'

export default {
  title: 'My Component',
  component: MyComponent
};

export const default = {};

export const rtlParameter = {
  // Optionally include direction as story parameter
  parameters: {
    direction: 'rtl'
  }
}

Query Params

You can also set the direction using query params in the URL. This is useful for things like e2e tests.

Just add &direction=rtl or &direction=ltr to the end of the URL:

storybook.example.com/?path=/story/button--standard&direction=rtl

Meta

Contributors

License

Copyright (c) 2023 Benjamin Kindle (@literalpie). This is free software, and may be redistributed under the terms specified in the LICENSE file.

Package Sidebar

Install

npm i storybook-addon-rtl

Weekly Downloads

13,793

Version

1.0.0

License

MIT

Unpacked Size

23.8 kB

Total Files

16

Last publish

Collaborators

  • unindented
  • bkindle