ActionList/ActionMenu API: Add trailingVisual alias#1521
Conversation
🦋 Changeset detectedLatest commit: 9a7936f The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
size-limit report 📦
|
@siddharthkp I think you mean |
|
@dusave Oh right! Updated :) |
|
@siddharthkp I think this looks great! My only concern is when dealing with more complex scenarios where there's the need for both string + icon, like the example you gave: (...)
trailingVisual: () => (
<>
⌘S<ArrowRightIcon />
</>
)
(...)That could appear in a future multi-level overlay scenario (with the trailing text being used to describe the selected value, and clicking on that item drills-in to another view where the selection happens). Thinking about the rendering of these elements, there should be an 8px spacing between the
✌️ |
|
I was wondering what's the benefit of combining these two props to one? Is it to reduce api surface area? |
We could add a space in the component but not sure if that's a reliable way to do it when it's a "bring your own content". 🤔
Yep! Make it easy to guess. ← leadingVisual trailingVisual →
trailingText probably doesn't qualify as "visual" though @vdepizzol Do you see |
As a consumer, please no auto-spacing. I would prefer to control my content, add spacing as needed (as well as any other styling).
As @siddharthkp said, this is to align with the align with the already-converted |
|
Ah I see, so if |
|
@siddharthkp Can you add a changeset for these changes? |
|
Co-authored-by: Cole Bemis <colebemis@github.com>
|
Updated |
trailingIconandtrailingTextas deprecatedtrailingVisualbut support old api as fallbacktrailingVisualexampleUse as text:
Freeform, use with icon:
Question: Should we drop direct
stringsupport and only support a component type to keep it consistent withleadingVisual?items={[ { text: 'New file', - trailingText: '⌘N' - trailingVisual: '⌘N' + trailingVisual: () => <>⌘N</> } ]} // types: - trailingVisual?: React.FunctionComponent<IconProps> | string + trailingVisual?: React.FunctionComponent