Skip to content

Commit

Permalink
Add custom input label style to not wrap the label
Browse files Browse the repository at this point in the history
  • Loading branch information
eneufeld authored and edgarmueller committed May 28, 2018
1 parent fc8fdf7 commit ab6cb5c
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion packages/material/src/controls/MaterialInputControl.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,14 @@ export class MaterialInputControl extends Control<ControlProps, ControlState> {
if (!visible) {
style.display = 'none';
}
const inputLabelStyle: {[x: string]: any} = {
'white-space': 'nowrap',
'overflow' : 'hidden',
'text-overflow': 'ellipsis',
// magic width as the label is transformed to 75% of its size
'width': '125%'
};

const showDescription = !isDescriptionHidden(visible, description, this.state.isFocused);

return (
Expand All @@ -69,7 +77,7 @@ export class MaterialInputControl extends Control<ControlProps, ControlState> {
onFocus={this.onFocus}
onBlur={this.onBlur}
>
<InputLabel htmlFor={id} error={!isValid}>
<InputLabel htmlFor={id} error={!isValid} style={inputLabelStyle}>
{computeLabel(isPlainLabel(label) ? label : label.default, required)}
</InputLabel>
<DispatchField uischema={uischema} schema={schema} path={parentPath} />
Expand Down

0 comments on commit ab6cb5c

Please sign in to comment.