Skip to content

How to use Remix Link components in Storybook #6273

Closed Answered by simonepizzamiglio
tachibanayu24 asked this question in Q&A
Discussion options

You must be logged in to vote

I'm on Remix 1.16.0 and Storybook 7.0.11, the following code works for me.

// Link.stories.tsx

import type { StoryObj, Meta } from '@storybook/react';
import { unstable_createRemixStub as createRemixStub } from '@remix-run/testing';
import { Link } from './Link';

const meta: Meta<typeof Link> = {
  title: 'components/Link',
  component: Link,
  decorators: [
    (Story) => {
      const RemixStub = createRemixStub([
        {
          path: '/',
          element: <Story />,
        },
      ]);

      return <RemixStub />;
    },
  ],
  tags: ['autodocs'],
  args: {
    children: "I'm a link",
    to: '/',
  },
};

export default meta;

type Story = StoryObj<typeof meta>;

export const 

Replies: 6 comments 18 replies

Comment options

You must be logged in to vote
1 reply
@tachibanayu24
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
12 replies
@tachibanayu24
Comment options

@simonepizzamiglio
Comment options

Answer selected by tachibanayu24
@tachibanayu24
Comment options

@maxxborer
Comment options

@maxxborer
Comment options

@RyanofWoods
Comment options

Comment options

You must be logged in to vote
3 replies
@AYastrebtsov
Comment options

@comuneoOrg
Comment options

@UnworldlyEel
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@nickfujita
Comment options

@thegrid22593
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet