docs/_snippets/nextjs-navigation-override-in-story.md
import NavigationBasedComponent from './NavigationBasedComponent';
export default {
component: NavigationBasedComponent,
parameters: {
nextjs: {
appDirectory: true,
},
},
};
// Interact with the links to see the route change events in the Actions panel.
export const Example = {
parameters: {
nextjs: {
navigation: {
pathname: '/profile',
query: {
user: '1',
},
},
},
},
};
// Replace your-framework with nextjs or nextjs-vite
import type { Meta, StoryObj } from '@storybook/your-framework';
import NavigationBasedComponent from './NavigationBasedComponent';
const meta = {
component: NavigationBasedComponent,
parameters: {
nextjs: {
appDirectory: true,
},
},
} satisfies Meta<typeof NavigationBasedComponent>;
export default meta;
type Story = StoryObj<typeof meta>;
// Interact with the links to see the route change events in the Actions panel.
export const Example: Story = {
parameters: {
nextjs: {
navigation: {
pathname: '/profile',
query: {
user: '1',
},
},
},
},
};
import preview from '../.storybook/preview';
import NavigationBasedComponent from './NavigationBasedComponent';
const meta = preview.meta({
component: NavigationBasedComponent,
parameters: {
nextjs: {
appDirectory: true,
},
},
});
// Interact with the links to see the route change events in the Actions panel.
export const Example = meta.story({
parameters: {
nextjs: {
navigation: {
pathname: '/profile',
query: {
user: '1',
},
},
},
},
});
import preview from '../.storybook/preview';
import NavigationBasedComponent from './NavigationBasedComponent';
const meta = preview.meta({
component: NavigationBasedComponent,
parameters: {
nextjs: {
appDirectory: true,
},
},
});
// Interact with the links to see the route change events in the Actions panel.
export const Example = meta.story({
parameters: {
nextjs: {
navigation: {
pathname: '/profile',
query: {
user: '1',
},
},
},
},
});