monday-ui-react-core
Version:
Official monday.com UI resources for application development in React.js
127 lines (94 loc) • 3.87 kB
text/mdx
import { Meta } from "@storybook/blocks";
import IconButton from "../IconButton";
import DialogContentContainer from "../../DialogContentContainer/DialogContentContainer";
import { Add, Bolt, Broom, HighlightColorBucket, Pin, Show } from "../../Icon/Icons";
import { BUTTON, ICON, MENU_BUTTON } from "../../../storybook/components/related-components/component-description-map";
import { TipCheckYourself, TipMenuButton } from "./IconButton.stories.helpers";
import * as IconButtonStories from "./IconButton.stories";
<Meta of={IconButtonStories} />
- [Overview](
- [Props](
- [Usage](
- [Variants](
- [Do’s and don’ts](
- [Use cases and examples](
- [Related components](
- [Feedback](
Icon button is a square button contains only icon with no visible text labels used mostly in control bars.
<Canvas of={IconButtonStories.Overview} />
<PropsTable />
<UsageGuidelines
guidelines={[
<>
Icon button will always appear with a <StorybookLink page="Popover/Tooltip">tooltip</StorybookLink> while
hovering, defining the icon’s meaning.
</>,
"Use an icon button when a user can perform an inline action on this page and there's no room for a default button.",
"Use icon button when you want to display an active state of a button.",
"Use a Primary icon button when it's the most important action to take.",
"Use icon button only when the icons is clear and understandable.",
"Icon buttons are often used when there are 2 or 3 adjacent icons buttons that perform actions on a single item presented in a row."
]}
/>
<TipCheckYourself />
There can be more than one button in a screen, but to create the hierarchy of actions we need to use button kinds.
<Canvas of={IconButtonStories.Kinds} />
<TipMenuButton />
<Canvas of={IconButtonStories.Sizes} />
<Canvas of={IconButtonStories.Active} />
Set disable button for something that isn’t usable. Use a tooltip on hover in order to indicate the reason of the disabled action.
<Canvas of={IconButtonStories.Disabled} />
<ComponentRules
rules={[
{
positive: {
component: (
<DialogContentContainer>
<IconButton icon={Pin} ariaLabel="Pin to top" />
<IconButton icon={Show} ariaLabel="Show all" />
<IconButton icon={HighlightColorBucket} ariaLabel="Show color" />
<IconButton icon={Broom} ariaLabel="Clear style" />
</DialogContentContainer>
),
description:
"Use Icon button when action is lower priority than a regular action or there’s no space available to place a button."
},
negative: {
component: <IconButton icon={Add} kind={IconButton.kinds.PRIMARY} ariaLabel="Add item" />,
description: (
<>
Don’t use Icon button as the main action on the page. Instead, use the{" "}
<StorybookLink page="Buttons/Button">Button component</StorybookLink> with an icon.
</>
)
}
},
{
positive: {
component: <IconButton icon={Bolt} ariaLabel="Quick Search" />,
description: "Always provide ariaLabel or tooltipContent"
},
negative: {
component: <IconButton icon={Bolt} />,
description: "Don’t use icon button without adding a tooltip while hovering."
}
}
]}
/>
<Canvas of={IconButtonStories.IconButtonAsToolbarButton} />
<Canvas of={IconButtonStories.IconButtonAsCloseButton} />
<RelatedComponents componentsNames={[BUTTON, MENU_BUTTON, ICON]} />