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
feat(ui): Let a Mosaic Item set its own outline variant
`variant` moves onto `Item.Root` as well as `Item.Group`, so a row standing on
its own can border itself. A row that sets one wins over its group, which also
lets a single row opt out of an outlined group with `default`.
Copy file name to clipboardExpand all lines: packages/swingset/src/stories/item.mdx
+25-17Lines changed: 25 additions & 17 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@ import * as ItemStories from './item.stories';
4
4
5
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
-
Set `variant='outline'` once on `Item.Group`and every row inside it gains a border, with the group spacing them apart rather than seating them on one surface.
7
+
Set `variant='outline'`on a row to border it, or once on `Item.Group`to border every row inside it — the group then spaces them apart rather than seating them on one surface.
8
8
9
9
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.
10
10
@@ -36,11 +36,20 @@ Set `size` once on `Item.Root` and the row scales as a unit: it fixes the row's
36
36
storyModule={ItemStories}
37
37
/>
38
38
39
+
### Outline
40
+
41
+
`variant='outline'` borders a row so it reads as its own card.
42
+
43
+
<Story
44
+
name='Outline'
45
+
storyModule={ItemStories}
46
+
/>
47
+
39
48
### Outline group
40
49
41
-
`Item.Group` takes a`variant`. `outline` borders each row and reads the set as separate cards, so
42
-
the group drops its own gutter and spaces the rows 8px apart instead. Rows pick the variant up from
43
-
the group through context — they take no `variant`prop of their own.
50
+
Set the same`variant` on `Item.Group` to border a whole set at once: the group drops its own gutter
51
+
and spaces the rows 8px apart instead. Rows pick it up from the group through context, so only a row
52
+
that disagrees needs a `variant` of its own.
44
53
45
54
<Story
46
55
name='OutlineGroup'
@@ -122,7 +131,7 @@ Media sizes itself from the row, so give it a child that fills its column — an
122
131
|`Item.Label`|`cl-item-label`| The row's label. Truncates to a single line. |
123
132
|`Item.Description`|`cl-item-description`| Secondary text beneath the label. Truncates to a single line. |
|`variant`|`data-variant`|`default`\|`outline`| its group's |
160
+
|`render`|`data-interactive`| present when a `render` is provided | — |
161
+
162
+
`Item.Group` reflects its own `variant` as `data-variant` on `.cl-item-group`.
155
163
156
164
`size` fixes the row's height and gap. `Item.Media` reflects the same value as `data-size` and takes its width from it, so the two stay in step without being set twice:
0 commit comments