Components
Radio Button

Radio Button

The VKRadioButton component is a customizable and accessible radio button element built with React. It allows developers to create reusable radio buttons with added styling and functionality.

Import

To utilize the Radio button component, import it from @vivakits/react-components.

import { VKRadioButton } from "@vivakits/react-components";

Variant

The variant prop defines the visual variant of the radio button. This include styles like circle square, providing flexibility in appearance.

Size

The size prop defines the size for the radio button. This prop allows for adjusting the size of the radio button to suit different design contexts, such as small, medium, or large etc. The Radio Button component comes with 6 different sizes.

Color

The color prop defines color variant for the radio button. This prop can be used to apply different color themes to the radio button, enhancing visual appeal and aligning with the application's branding. It comes with 7 different colors.

Usage Example

Selected Value: option1

API Reference

Radio Button

AttributeTypeDescriptionDefault
idstringUnique identifier for the radio button -
valuestringnumberSets inner value when radio button is checked -
selectedValuestringnumberCurrently selected value to determine checked state -
onChange(event: React.ChangeEvent<HTMLInputElement>) => voidHandler for label click events -
onLabelClick(event: React.MouseEvent<HTMLLabelElement>) => voidHandler for label click events -
variantcirclesquareChanges Changes the shape of radio buttoncircle
sizexssmmdlgxl2xlChanges the size of radio buttonsm
colorprimarysecondarysuccesswarningdangerdarklightChanges the color of radio buttonprimary
classNamestringApplies custom className to the radio button -
labelClassNamestringAdditional classes for the radio button label-
wrapperClassNamestringSets className for the wrapper around radio button -
refReact.RefObjectAttaches reference to the wrapper div -
inputRefReact.RefObjectAttaches reference to the radio button -