diff --git a/canon-docs/src/app/(docs)/components/icon-button/page.mdx b/canon-docs/src/app/(docs)/components/icon-button/page.mdx new file mode 100644 index 0000000000..591ee321eb --- /dev/null +++ b/canon-docs/src/app/(docs)/components/icon-button/page.mdx @@ -0,0 +1,111 @@ +import { PropsTable } from '@/components/PropsTable'; +import { Snippet } from '@/components/Snippet'; +import { Tabs } from '@/components/Tabs'; +import { CodeBlock } from '@/components/CodeBlock'; +import { + IconButtonPreview, + IconButtonSizes, + IconButtonDisabled, + IconButtonResponsive, +} from '@/snippets/icon-button'; +import { iconButtonVariants } from '@/snippets/_snippets'; +import { iconButtonPropDefs } from '../../../../../../packages/canon/src/components/IconButton/IconButton.props'; + +# Icon Button + +A button component with a single icon that can be used to trigger actions. + +} + code={` + + +`} +/> + + + + Usage + Theming + + + +`} + /> + + + We recommend starting with our [global tokens](/theme/theming) to customize the library and align it with + your brand. For additional flexibility, you can use the provided class names for each element listed below. + `} + /> + + + + +## API reference + + + +## Examples + +### Variants + +Here's a view when buttons have different variants. + +} + code={iconButtonVariants} +/> + +### Sizes + +Here's a view when buttons have different sizes. + +} + code={` + + +`} +/> + +### Disabled + +Here's a view when buttons are disabled. + +} + code={``} +/> + +### Responsive + +Here's a view when buttons are responsive. + +} + code={``} +/> diff --git a/canon-docs/src/components/PropsTable/PropsTable.tsx b/canon-docs/src/components/PropsTable/PropsTable.tsx index aa6b9f296e..62917eaeed 100644 --- a/canon-docs/src/components/PropsTable/PropsTable.tsx +++ b/canon-docs/src/components/PropsTable/PropsTable.tsx @@ -19,10 +19,6 @@ export const PropsTable = >({ }) => { const completeData = { ...data, - children: { - values: 'ReactNode', - responsive: false, - }, className: { values: 'string', responsive: false, diff --git a/canon-docs/src/snippets/_snippets.ts b/canon-docs/src/snippets/_snippets.ts index 75ff5056f4..00a9c1462d 100644 --- a/canon-docs/src/snippets/_snippets.ts +++ b/canon-docs/src/snippets/_snippets.ts @@ -38,7 +38,7 @@ export const grid = `import { Grid } from '@backstage/canon'; `; -export const buttonVariants = ` +export const buttonVariants = ` @@ -48,7 +48,13 @@ export const buttonVariants = ` - + +`; + +export const iconButtonVariants = ` + + + `; export const flexFAQ1 = ` diff --git a/canon-docs/src/snippets/icon-button.tsx b/canon-docs/src/snippets/icon-button.tsx new file mode 100644 index 0000000000..2079041456 --- /dev/null +++ b/canon-docs/src/snippets/icon-button.tsx @@ -0,0 +1,57 @@ +'use client'; + +import { IconButton, Flex, ButtonProps, Text } from '../../../packages/canon'; + +export const IconButtonPreview = () => { + return ( + + + + + ); +}; + +export const IconButtonSizes = () => { + return ( + + + + + ); +}; + +export const IconButtonDisabled = () => { + return ; +}; + +export const IconButtonResponsive = () => { + return ( + + ); +}; + +export const IconButtonPlayground = () => { + const variants: string[] = ['primary', 'secondary']; + + return ( + + {variants.map(variant => ( + + {variant} + {['small', 'medium'].map(size => ( + + + + ))} + + ))} + + ); +}; diff --git a/canon-docs/src/utils/data.ts b/canon-docs/src/utils/data.ts index c454b76d71..6aa487d93a 100644 --- a/canon-docs/src/utils/data.ts +++ b/canon-docs/src/utils/data.ts @@ -87,6 +87,11 @@ export const components: Page[] = [ slug: 'icon', status: 'alpha', }, + { + title: 'IconButton', + slug: 'icon-button', + status: 'alpha', + }, { title: 'Input', slug: 'input',