Skip to content

Commit

Permalink
feat: add NoWrapSpace Text component
Browse files Browse the repository at this point in the history
  • Loading branch information
trevor-anderson committed Feb 20, 2024
1 parent 3956f82 commit f69e74b
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions src/components/Text/NoWrapSpace.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/**
* Use this component to add a non-breaking space that will not wrap to a new line.
*
* ```tsx
* // Example:
* <p>
* This text will wrap as needed, but the last word will "stick" to the HelpInfoIcon
* <NoWrapSpace />
* <HelpInfoIcon
* tooltip="This icon will never be orphaned onto its own line all alone - huzzah!🎉"
* />
* </p>
* ```
*/
export const NoWrapSpace = () => (
<span
style={{
fontSize: "inherit",
fontWeight: "inherit",
lineHeight: "inherit",
whiteSpace: "nowrap",
}}
>
&nbsp;
</span>
);

0 comments on commit f69e74b

Please sign in to comment.