All files / app/ui/form Label.tsx

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30118x 118x             118x 2309x 2309x 2309x 2309x 2309x 2309x                           118x  
import classNames from 'classnames';
import React, { FunctionComponent, LabelHTMLAttributes } from 'react';
 
export interface LabelProps extends LabelHTMLAttributes<HTMLLabelElement> {
    testId?: string;
    hidden?: boolean;
}
 
const Label: FunctionComponent<LabelProps> = ({
    children,
    className,
    hidden,
    testId,
    ...rest
}) => (
    <label
        { ...rest }
        className={ classNames(
            className || 'form-label',
            { 'is-srOnly': hidden },
            'optimizedCheckout-form-label'
        ) }
        data-test={ testId }
    >
        { children }
    </label>
);
 
export default Label;