-
Notifications
You must be signed in to change notification settings - Fork 380
ClipboardCopy - Allow truncate flexibility #10890
Copy link
Copy link
Milestone
Description
ClipboardCopy currently truncates at the end. It may be nice in some cases to truncate at the start or middle (similar to how Truncate component works).
A workaround could currently work with inline-compact with some hacking, see https://codesandbox.io/p/sandbox/red-wind-zdgyqf
<ClipboardCopy
variant={"inline-compact"}
style={{ display: "inline-flex" }}
clickTip="Copied"
onCopy={() => {
navigator.clipboard.writeText(textToCopy);
}}
>
<Truncate
content={textToCopy}
trailingNumChars={10}
position={"middle"}
/>
</ClipboardCopy>
However, this wouldn't work with other variants. They all use TextInput, as part of this feature I believe TextInput would also have to be updated to work with middle truncate (currently it only has start/end).
Could use props like truncatePosition, and truncateTrailingNumChars for middle.
This came up in a slack conversation with Vince Consola and @christianvogt
It would also be nice if inline-compact supported truncate by itself as well.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
Type
Projects
Status
Done