/
githubmirror
/
gutenberg
Обзор
Документация
Войти
/
githubmirror
/
gutenberg
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
trunk
packages/components/src/input-control/label.tsx
34 строки
723 B
Marco Ciampini
ESLint: Replace strict config with bulk suppressions (#81248)
07 авг 2026, 14:34
Не верифицирован
07 авг 2026, 14:34
7f43eaf
Код
Авторство
О чём код?
import { VisuallyHidden } from '../visually-hidden'; import { Label as BaseLabel, LabelWrapper, } from './styles/input-control-styles'; import type { WordPressComponentProps } from '../context'; import type { InputControlLabelProps } from './types'; export default function Label( { children, hideLabelFromVision, htmlFor, ...props }: WordPressComponentProps< InputControlLabelProps, 'label', false > ) { if ( ! children ) { return null; } if ( hideLabelFromVision ) { return ( <VisuallyHidden as="label" htmlFor={ htmlFor }> { children } </VisuallyHidden> ); } return ( <LabelWrapper> <BaseLabel htmlFor={ htmlFor } { ...props }> { children } </BaseLabel> </LabelWrapper> ); }