Skip to content

adrian-marcelo-gallardo/storybook-addon-rtl

 
 

Repository files navigation

Storybook Addon RTL Version Build Status

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

This addon works with Storybook for: React.

Storybook Addon RTL Demo

Getting Started

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

Create a file called addons.js in your storybook config, and add the following content to it:

import 'storybook-addon-rtl/register';

Create a file called config.js in your storybook config, and add the following content to it:

import { configure } from '@storybook/react';
import { initializeRTL } from 'storybook-addon-rtl';

initializeRTL();

configure(() => { require('./stories') }, module);

Then write your stories normally:

import React from 'react';
import { storiesOf } from '@storybook/react';
import Component from './Component';

storiesOf('Component', module)
  .add('default', () => (
    <Component />
  ));

Note: You can force a story to show in right-to-left mode by adding the query parameter direction=rtl.

Meta

Contributors

License

Copyright (c) 2017 Daniel Perez Alvarez (unindented.org). This is free software, and may be redistributed under the terms specified in the LICENSE file.

About

Right-to-left addon for Storybook.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%