1
0
mirror of https://github.com/bitwarden/browser synced 2026-02-19 19:04:01 +00:00
Files
browser/libs/components/src/avatar/avatar.mdx
Bryan Cunningham 5eb8d7b181 [CL-208][CL-339] Enhance Storybook docs pages (#14838)
* rearrange button docs

* Enhance avatar docs

* Enhance badge  docs

* Enhance banner docs

* add util to format args for snippets

* update banner snippets

* WIP

* bind boolean args so they work correctly in Storybook

* simplify button stories

* Update callout docs

* use title component for checkbox docs

* use title and description  component for chip select docs

* update color password story docs

* update disclosure docs

* add import to icon docs

* updated icon-button docs

* update link docs

* Update prgress docs

* updated search field docs

* remove html type definitions

* add import for progress

* updated toast docs

* remove example from docs. format args for snippet

* Update badges docs

* handle array arg values correctly

* Update badges list docs

* fix dupe key error from taost story

* remove unnecessary typeof check

* remove banner usage example

* add breadcrumbs import statement and jsdoc

* add color password import statement

* fixing type mismaches

* fix typos

* Add missing generics to format function

* fix typo

* update callout icon spacing to match Figma

* add back max width container
2025-05-30 12:38:40 -04:00

68 lines
1.7 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { Description, Meta, Canvas, Primary, Controls, Title } from "@storybook/addon-docs";
import * as stories from "./avatar.stories";
<Meta of={stories} />
```ts
import { AvatarModule } from "@bitwarden/components";
```
<Title />
<Description />
<Primary />
<Controls />
## Size
### Large: 64px
<Canvas of={stories.Large} />
### Default: 48px
<Canvas of={stories.Default} />
### Small 28px
<Canvas of={stories.Small} />
## Background color
The Background color can be set 3 ways. The color is generated using the following order of
priority:
- Color
- ID
- Text, usually set to the user's Name field
<Canvas of={stories.ColorByText} />
Use the user 'ID' field if `Name` is not defined.
<Canvas of={stories.ColorByID} />
## Outline
If the avatar is displayed on one of the theme's `background` color variables or is interactive,
display the avatar with a 1 pixel `secondary-600` border to meet WCAG AA graphic contrast guidelines
for interactive elements.
<Canvas of={stories.Border} />
## Avatar as a button
The Avatar can be used as a button.
Typically this is only in the navigation on client apps where account switching is used and in the
web app for the account menu indicator.
When the avatar is used as a button, the following states should be used:
`TODO:` [Jira add stories](https://bitwarden.atlassian.net/browse/CL-101) for button avatars.
[See Figma](https://www.figma.com/file/Zt3YSeb6E6lebAffrNLa0h/Tailwind-Component-Library?type=design&node-id=9730-31746&mode=design&t=IjDIHDb6FZl6bUQW-4)
## Accessibility
Avatar background color should have 3.1:1 contrast with its background; or include the
`secondary-600` border Avatar text should have 4.5:1 contrast with the avatar background color