Skip to content

Commit

Permalink
fix(Select): long inline label now truncates
Browse files Browse the repository at this point in the history
  • Loading branch information
DSil committed Jun 23, 2023
1 parent 54f2eec commit 17758b4
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
20 changes: 20 additions & 0 deletions packages/orbit-components/src/Select/Select.stories.tsx
Expand Up @@ -66,6 +66,26 @@ WithCountryFlagPrefix.story = {
},
};

export const WithLongLabel = () => {
const inlineLabel = boolean("inlineLabel", true);
return (
<Select
label="Select box (with long label)"
options={objectOptions}
onChange={action("onChange")}
inlineLabel={inlineLabel}
/>
);
};

WithLongLabel.story = {
name: "With long label",

parameters: {
info: "Long labels truncate automatically when inline.",
},
};

export const WithPlaceholder = () => {
const placeholder = text("Placeholder", "Select value from list");
return (
Expand Down
4 changes: 4 additions & 0 deletions packages/orbit-components/src/Select/index.tsx
Expand Up @@ -44,10 +44,14 @@ const StyledInlineLabel = styled.div<{ hasFeedback?: boolean }>`
)};
${FormLabel} {
display: inline-block;
margin-bottom: 0;
font-size: ${theme.orbit.fontSizeInputNormal};
line-height: ${theme.orbit.lineHeightTextNormal};
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
max-width: 20ch;
}
`}
`;
Expand Down

0 comments on commit 17758b4

Please sign in to comment.