Skip to content

Commit

Permalink
refactor(FormLabel): convert FormLabel to TypeScript
Browse files Browse the repository at this point in the history
  • Loading branch information
lewandom committed Aug 23, 2023
1 parent 5a99bf3 commit 095f94e
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,30 @@ import React from 'react';
import cx from 'classnames';
import { usePrefix } from '../../internal/usePrefix';

function FormLabel({ className: customClassName, children, id, ...rest }) {
export interface FormLabelProps
extends Omit<React.LabelHTMLAttributes<HTMLLabelElement>, 'htmlFor'> {
/**
* Specify the content of the form label
*/
children?: React.ReactNode;

/**
* Provide a custom className to be applied to the containing <label> node
*/
className?: string;

/**
* Provide a unique id for the given <FormLabel>
*/
id?: string;
}

function FormLabel({
className: customClassName,
children,
id,
...rest
}: FormLabelProps) {
const prefix = usePrefix();
const className = cx(
`${prefix}--label`,
Expand Down

0 comments on commit 095f94e

Please sign in to comment.