Skip to content

Commit

Permalink
fix(InputLabel): Added prop to control label text alignment
Browse files Browse the repository at this point in the history
  • Loading branch information
HHogg committed Jun 18, 2024
1 parent 47b8193 commit 9fc1623
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion workspaces/package/src/Input/InputLabel.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { forwardRef } from 'react';
import { Box, BoxProps } from '../Box/Box';
import { Text } from '../Text/Text';
import { Text, TextProps } from '../Text/Text';

/**
* The label element of the input. This should be placed
Expand All @@ -11,6 +11,10 @@ export interface InputLabelProps extends Omit<BoxProps, 'label'> {
* A helpful description that can be displayed under the input.
*/
description?: string | JSX.Element;
/**
* Alignment of the description text.
*/
descriptionAlign?: TextProps['align'];
/**
* The label string that is rendered above the Input.
*/
Expand All @@ -21,6 +25,7 @@ export const InputLabel = forwardRef<any, InputLabelProps>((props, ref) => {
const {
children,
description,
descriptionAlign,
label,
paddingHorizontal = 'x3',
tag = 'label',
Expand Down Expand Up @@ -59,6 +64,7 @@ export const InputLabel = forwardRef<any, InputLabelProps>((props, ref) => {

{description && (
<Text
align={descriptionAlign}
paddingHorizontal={paddingHorizontal}
size="x2"
textColor="text-shade-3"
Expand Down

0 comments on commit 9fc1623

Please sign in to comment.