Skip to content

Commit

Permalink
Card button API docs
Browse files Browse the repository at this point in the history
  • Loading branch information
jattasNI committed May 16, 2024
1 parent ced7483 commit 108d201
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
3 changes: 3 additions & 0 deletions packages/storybook/src/nimble/card-button/card-button.mdx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Canvas, Meta, Controls, Title } from '@storybook/blocks';
import { NimbleCardButton } from './card-button.react';
import { anchorButtonTag } from '@ni/nimble-components/dist/esm/anchor-button';
import { cardButtonTag } from '@ni/nimble-components/dist/esm/card-button';
import { buttonTag } from '@ni/nimble-components/dist/esm/button';
import * as cardButtonStories from './card-button.stories';
Expand All @@ -10,6 +11,8 @@ import * as cardButtonStories from './card-button.stories';
The <Tag name={cardButtonTag}/> is a button that is designed to contain arbitrary content that is specified by a client
application. The <Tag name={cardButtonTag}/> is intended to be larger and more prominent on a page than the standard <Tag name={buttonTag}/>.

If you want a button that triggers navigation to a URL, use the <Tag name={anchorButtonTag}/> instead.

Note: The styling for the "Color" theme is not complete.

<Canvas of={cardButtonStories.cardButton} />
Expand Down
26 changes: 25 additions & 1 deletion packages/storybook/src/nimble/card-button/card-button.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@ import { withActions } from '@storybook/addon-actions/decorator';
import type { HtmlRenderer, Meta, StoryObj } from '@storybook/html';
import { bodyFont } from '@ni/nimble-components/dist/esm/theme-provider/design-tokens';
import { cardButtonTag } from '@ni/nimble-components/dist/esm/card-button';
import { createUserSelectedThemeStory } from '../../utilities/storybook';
import { apiCategory, createUserSelectedThemeStory, disabledDescription } from '../../utilities/storybook';

interface CardButtonArgs {
disabled: boolean;
selected: boolean;
content: string;
click: () => void;
}

const metadata: Meta<CardButtonArgs> = {
Expand Down Expand Up @@ -52,6 +54,28 @@ const metadata: Meta<CardButtonArgs> = {
args: {
disabled: false,
selected: false
},
argTypes: {
disabled: {
description: disabledDescription({ componentName: 'card button' }),
table: { category: apiCategory.attributes }
},
selected: {
description: 'Styles the card button to indicate it is selected.',
table: { category: apiCategory.attributes }
},
content: {
name: 'default',
description: 'The card button allows arbitrary HTML child content in its default slot.',
table: { category: apiCategory.slots },
control: false
},
click: {
description:
'Fires when the card button is activated by either keyboard or mouse.',
table: { category: apiCategory.events },
control: false
}
}
};

Expand Down

0 comments on commit 108d201

Please sign in to comment.