본문으로 바로가기 본문 바로가기
WIKI 기술 지식 베이스

Radio

원문 보기 위키 갱신

출처: 문서

본문

Examples

Controlled

Controlled Radio

Uncontrolled

Uncontrolled radio example

Reversed

Reversed radio example

Label wraps

You can expand the clickable area of a radio so that it spans wider than the radio label by adding the isLabelWrapped property. This allows users to select a radio by clicking the radio itself, the label, or the area between the radio and the label.

Label wraps input example

Disabled

Disabled radio example

Disabled and checked radio example

With description

Radio with description exampleSingle-tenant cloud service hosted and managed by Red Hat that offers high-availability enterprise-grade clusters in a virtual private cloud on AWS or GCP.

With body

Radio with bodyThis is where custom content goes.

With description and body

Radio with description and bodySingle-tenant cloud service hosted and managed by Red Hat that offers high-availability enterprise-grade clusters in a virtual private cloud on AWS or GCP.This is where custom content goes.

Standalone input

Props

Radio

required | | Name | Type | Default | Description | idrequired | string | | Id of the radio.

| name*required | string | | Name for group of radios

| aria-describedby | string | | Custom aria-describedby value for the radio input. If not provided and description is set, a unique ID will be generated automatically.

| aria-label | string | | Aria label for the radio.

| body | React.ReactNode | | Body of the radio.

| checked | boolean | | Flag to show if the radio is checked.

| className | string | '' | Additional classes added to the radio wrapper. This wrapper will be div element by default. It will be a label element if isLabelWrapped is true, or it can be overridden by any element specified in the component prop.

| component | React.ElementType | | Sets the radio wrapper component to render. Defaults to "div". If set to "label", behaves the same as if isLabelWrapped prop was specified.

| description | React.ReactNode | | Description text of the radio.

| inputClassName | string | | Additional classes added to the radio input.

| isChecked | boolean | | Flag to show if the radio is checked.

| isDisabled | boolean | false | Flag to show if the radio is disabled.

| isLabelWrapped | boolean | | Flag to indicate whether the radio wrapper element is a native label element for the radio input. Will not apply if a component prop (with a value other than a "label") is specified.

| isValid | boolean | true | Flag to show if the radio selection is valid or invalid.

| label | React.ReactNode | | Label text of the radio.

| labelPosition | 'start' | 'end' | | Sets the position of the label. Defaults to 'end' (after the radio input).

| onChange | (event: React.FormEvent, checked: boolean) => void | () => {} | A callback for when the radio selection changes.

| ouiaId | number | string | | Value to overwrite the randomly generated data-ouia-component-id.

| ouiaSafe | boolean | | Set the value of data-ouia-safe. Only set to true when the component is in a static state, i.e. no animations are occurring. At all other times, this value must be false.

Edit this page on GitHub

더 알아보기 (Learn more)