diff --git a/tgui/docs/component-reference.md b/tgui/docs/component-reference.md index 4e74b9de335..d3352c4ccb8 100644 --- a/tgui/docs/component-reference.md +++ b/tgui/docs/component-reference.md @@ -229,6 +229,10 @@ the baseline alignment. over the button. - `children: any` - Content to render inside the button. - `onClick: function` - Called when element is clicked. +- `verticalAlign: string` - Align content vertically. + - `top` - align content to the ceiling of the button box. + - `middle` - align content on the middle of the button box. + - `bottom` - align content on the ground of the button box. ### `Button.Checkbox` diff --git a/tgui/packages/tgui/components/Button.js b/tgui/packages/tgui/components/Button.js index b4b9b905b18..dc7538a98cd 100644 --- a/tgui/packages/tgui/components/Button.js +++ b/tgui/packages/tgui/components/Button.js @@ -35,6 +35,7 @@ export const Button = props => { children, onclick, onClick, + verticalAlign, ...rest } = props; const hasContent = !!(content || children); @@ -67,6 +68,7 @@ export const Button = props => { circular && 'Button--circular', compact && 'Button--compact', iconPosition && 'Button--iconPosition--' + iconPosition, + verticalAlign && 'Button--verticalAlign--' + verticalAlign, (color && typeof color === 'string') ? 'Button--color--' + color : 'Button--color--default', @@ -94,22 +96,26 @@ export const Button = props => { } }} {...computeBoxProps(rest)}> - {(icon && iconPosition !== 'right') && ( - - )} - {content} - {children} - {(icon && iconPosition === 'right') && ( - - )} +
+ {icon && iconPosition !== 'right' && ( + + )} + {content} + {children} + {icon && iconPosition === 'right' && ( + + )} +
); diff --git a/tgui/packages/tgui/styles/components/Button.scss b/tgui/packages/tgui/styles/components/Button.scss index ac2974f9ff8..d777e551ba1 100644 --- a/tgui/packages/tgui/styles/components/Button.scss +++ b/tgui/packages/tgui/styles/components/Button.scss @@ -45,6 +45,7 @@ $bg-map: colors.$bg-map !default; .Button { position: relative; display: inline-block; + display: inline-flex; line-height: 1.667em; padding: 0 0.5em; margin-right: base.em(2px); @@ -90,6 +91,7 @@ $bg-map: colors.$bg-map !default; .Button--fluid { display: block; + display: flex; margin-left: 0; margin-right: 0; } @@ -134,3 +136,19 @@ $bg-map: colors.$bg-map !default; .Button--selected { @include button-color($color-selected); } + +.Button--verticalAlign--top { + align-items: flex-start; +} + +.Button--verticalAlign--middle { + align-items: center; +} + +.Button--verticalAlign--bottom { + align-items: flex-end; +} + +.Button__content--fluid { + flex: 1; +}