Skip to main content

Radio

Radio controls are pretty much essential for any application. PCR makes it easy to add stylish radio controls to your application ๐Ÿ‘

Shapes, Variants, & States#

There's no "one size fits all" for input controls like Radio. Thankfully, PCR allows you to represent Radio in various ways via the shape and variant prop for pre-bundled fun. See the shapes docs for more details.

Live Editor
Result
SyntaxError: Unexpected token (1:8)
1 : return ()
            ^

Disabled & Locked#

Of course disabled is supported, but there's also a secondary state called locked. See the states docs for more details.

Live Editor
Result
SyntaxError: Unexpected token (1:8)
1 : return ()
            ^

Scalability#

Out of the box, PCR offers a bigger prop to make all input controls just a tad bit larger. For more fine-grained control check out the size docs.

Live Editor
Result
SyntaxError: Unexpected token (1:8)
1 : return ()
            ^

Uncontrolled#

Radio forwards refs to the input element ๐Ÿ˜„. See the uncontrolled component docs for more info.

Live Editor
Result
SyntaxError: Unexpected token (1:8)
1 : return ()
            ^

Controlled#

PCR exposes helpful state hooks to make managing state a breeze. For radio you should use useRadioState. See the controlled component docs for more info.

Boolean Radios#

Like checkbox, Radio supports boolean modes for simple yes/no options:

Live Editor
Result
SyntaxError: Unexpected token (1:8)
1 : return ()
            ^

Named Radios#

Typically Radio will have a value associated with the control. Unlike checkbox, Radio works with single controls and does not store named results in an array.

Live Editor
Result
SyntaxError: Unexpected token (1:8)
1 : return ()
            ^