Search...

Radio

Contrast Angular Bootstrap Radio

Contrast Angular Bootstrap Radio button is a component that allow users to select an option from a list of options, while Checkboxes are for selecting multiple options.

Importing the Contrast Angular Bootstrap Radio Module

To use the Contrast Angular Bootstrap Radio component in your project you need to import RadioModule.

ts
import {RadioModule } from 'cdbangular';

Single Radio

Use the Contrast Angular Bootstrap CDBRadio component to create radio buttons.

Angular Bootstrap Radio

HTML
html
<CDBRadio value="Choice 1" fill="#eb7434" colorfill="#eb7434"></CDBRadio>
<CDBRadio value="Choice 2" fill="green" colorfill="red"></CDBRadio>
<CDBRadio value="Choice 3" fill="#000000" colorfill="#000000"></CDBRadio>

Radio Group

Creating multiple radio buttons may be hectic, and with the Contrast Angular Bootstrap RadioGroup component, frankly unnecessary.

With CDBRadioGroup component, you have an [answers] prop. This [answers] prop takes in an array of choices and creates multiple radio buttons.

Angular Bootstrap Radio Group

HTML
html
<CDBRadioGroup fill="#eb7434" colorfill="#eb7434" [answers]="['Choice 1', 'Choice 2' , 'Choice 3' , 'Choice 4' ]"></CDBRadioGroup>

API

This section will build on your information about the props you get to use with the Contrast Angular Bootstrap Radio component. You will find out what these props do, their default values, and how you would use them in your code.

API Reference: Contrast Radio Props

The table below lists other prop options of the CDBRadio.

NameTypeDefaultDescriptionExample
classStringAdds custom classesclass="myClass"
fillString#455ff5Sets the color of the unselected radio buttonfill="#000000"
colorfillStringSets the color of the selected radio buttoncolorFill="#000000"
valueStringThe value of the input elementvalue="Choice1"

API Reference: Contrast Radio Group Props

The table below lists other prop options of the CDBRadioGroup.

NameTypeDefaultDescriptionExample
classNameStringAdds custom classesclass="myClass"
fillString#455ff5Sets the color of the unselected radio buttonfill="#000000"
colorfillStringSets the color of the selected radio buttoncolorFill="#000000"
answersArray[]The list of values of the input elementanswers=[choice1, choice2, choice3]

Build modern projects using Bootstrap 5 and Contrast

Trying to create components and pages for a web app or website from scratch while maintaining a modern User interface can be very tedious. This is why we created Contrast, to help drastically reduce the amount of time we spend doing that. so we can focus on building some other aspects of the project.

Contrast Bootstrap PRO consists of a Premium UI Kit Library featuring over 10000+ component variants. Which even comes bundled together with its own admin template comprising of 5 admin dashboards and 23+ additional admin and multipurpose pages for building almost any type of website or web app.
See a demo and learn more about Contrast Bootstrap Pro by clicking here.

ad-banner