📄 radixui/primitives/docs/components/label

File: label.md | Updated: 11/15/2025

Source: https://www.radix-ui.com/primitives/docs/components/label

Radix Homepage

Made by WorkOS

Radix Homepage

Made by WorkOS

ThemesThemes PrimitivesPrimitives IconsIcons ColorsColors

Documentation Case studies Blog

Search

/

Overview

Introduction Getting started Accessibility Releases

Guides

Styling Animation Composition Server-side rendering

Components

Accordion Alert Dialog Aspect Ratio Avatar Checkbox Collapsible Context Menu Dialog Dropdown Menu Form

Preview
Hover Card Label Menubar Navigation Menu One-Time Password Field

Preview
Password Toggle Field

Preview
Popover Progress Radio Group Scroll Area Select Separator Slider Switch Tabs Toast Toggle Toggle Group Toolbar Tooltip

Utilities

Accessible Icon Direction Provider Portal Slot Visually Hidden

Components

Label

Renders an accessible label associated with controls.

First name

index.jsxindex.jsxstyles.cssstyles.css

CSS

import * as React from "react";
import { Label } from "radix-ui";
import "./styles.css";

const LabelDemo = () => (
	<div
		style={{
			display: "flex",
			padding: "0 20px",
			flexWrap: "wrap",
			gap: 15,
			alignItems: "center",
		}}
	>
		<Label.Root className="LabelRoot" htmlFor="firstName">
			First name
		</Label.Root>
		<input
			className="Input"
			type="text"
			id="firstName"
			defaultValue="Pedro Duarte"
		/>
	</div>
);

export default LabelDemo;

Features

Text selection is prevented when double clicking label.

Supports nested controls.

Installation


Install the component from your command line.

npm install @radix-ui/react-label

Anatomy


Import the component.

import { Label } from "radix-ui";

export default () => <Label.Root />;

API Reference


Root

Contains the content for the label.

| Prop | Type | Default | | --- | --- | --- | | asChild<br><br>Prop description | boolean | false | | htmlFor<br><br>Prop description | string | No default value |

Accessibility


This component is based on the native label element, it will automatically apply the correct labelling when wrapping controls or using the htmlFor attribute. For your own custom controls to work correctly, ensure they use native elements such as button or input as a base.

PreviousHover Card

NextMenubar

Edit this page on GitHub.