You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: packages/swingset/src/stories/item.mdx
+21-16Lines changed: 21 additions & 16 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@ import * as ItemStories from './item.stories';
2
2
3
3
# Item
4
4
5
-
Item is a flexible row for lists of accounts, organizations, and settings in Mosaic. It's composed from parts via dot syntax (`Item.Root`, `Item.Media`, `Item.Content`, `Item.Title`, …). `Item.Root` renders as a `<div>` by default; pass it a `render` prop to make a row an interactive link or button, which adds hover and cursor affordances.
5
+
Item is a flexible row for lists of accounts, organizations, and settings in Mosaic. It's composed from parts via dot syntax (`Item.Root`, `Item.Media`, `Item.Content`, `Item.Label`, …). `Item.Root` renders as a `<div>` by default; pass it a `render` prop to make a row an interactive link or button, which adds hover and cursor affordances.
6
6
7
7
Set `size` once on `Item.Root` and the row scales as a unit: it fixes the row's height and gap, and `Item.Media` picks the matching column width up from context rather than taking a size of its own.
8
8
@@ -76,7 +76,7 @@ import { Item } from '@clerk/ui/mosaic/components/item';
76
76
</Avatar.Root>
77
77
</Item.Media>
78
78
<Item.Content>
79
-
<Item.Title>Test Organization</Item.Title>
79
+
<Item.Label>Test Organization</Item.Label>
80
80
<Item.Description>Member</Item.Description>
81
81
</Item.Content>
82
82
<Item.Actions>
@@ -86,38 +86,43 @@ import { Item } from '@clerk/ui/mosaic/components/item';
86
86
</Item.Group>;
87
87
```
88
88
89
-
Media sizes itself from the row, so give it a child that fills its column — an `Avatar.Root` with `size='fit'`, or an `Icon`. An action row that has no secondary text uses `Item.Label`in place of `Item.Title`:
89
+
Media sizes itself from the row, so give it a child that fills its column — an `Avatar.Root` with `size='fit'`, or an `Icon`. A row whose text _is_ the row, rather than naming a subject, uses `Item.Label`with `variant='secondary'`:
|`Item.Group`|`cl-item-group`| Vertical wrapper around a set of rows (layout only, no role). |
113
+
|`Item.Separator`|`cl-item-separator`| Thin divider (`<hr>`) between rows. |
115
114
116
115
Every part accepts a `render` prop for element polymorphism and forwards a ref.
117
116
118
117
## Styling
119
118
120
-
The row carries the text color and, through `--_cl-icon-color`, the strength of any `Icon` inside it: faded at rest, full-strength while hovered. Only interactive rows promote — a static row isn't pointing at anything, so its icon and `Item.Label` hold their resting color. A `Button` in `Item.Actions` sets its own icon color and is unaffected.
119
+
The row carries the text color and, through `--_cl-icon-color`, the strength of any `Icon` inside it: faded at rest, full-strength while hovered. Only interactive rows promote — a static row isn't pointing at anything, so its icon holds its resting color. A `Button` in `Item.Actions` sets its own icon color and is unaffected.
120
+
121
+
`Item.Label` chooses whether it joins that promotion. `variant='primary'` sets its own color and holds it, so a subject the row names reads at full strength either way. `variant='secondary'` sets none and inherits the row's, so it fades and brightens with the row:
0 commit comments