How To Use Checkboxes in ReactJS? Last Updated : 07 Oct, 2024 Comments Improve Suggest changes Like Article Like Report Checkboxes are essential UI components used in web applications that allow users to select one or more options from a list. React makes it simple to work with checkboxes, whether you're dealing with a single checkbox or a list of checkboxes. In this article, we will see how to use Checkboxes in ReactJS.Steps To Use Checkboxes in ReactJSStep 1: Create a React application using the following command:npx create-react-app foldernamecd foldernameStep 2: Install the material-ui modules using the following command:npm install @material-ui/core npm install @material-ui/lab npm install @material-ui/iconsProject StructureProject StructureExample: Now write down the following code in the App.js file. Here, App is our default component where we have written our code. JavaScript //App.js import React from 'react' import TextField from '@material-ui/core/TextField'; import Autocomplete from '@material-ui/lab/Autocomplete'; import Checkbox from '@material-ui/core/Checkbox'; import CheckBoxOutlineBlankIcon from '@material-ui/icons/CheckBoxOutlineBlank'; import CheckBoxIcon from '@material-ui/icons/CheckBox'; const icon = <CheckBoxOutlineBlankIcon fontSize="small" />; const checkedIcon = <CheckBoxIcon fontSize="small" />; const App = () => { // Our sample dropdown options const options = ['Monday', 'Tuesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'] return ( <div style={{ marginLeft: '40%', marginTop: '60px' }}> <h3>Greetings from GeeksforGeeks!</h3> <Autocomplete multiple id="checkboxes-tags-demo" options={options} renderOption={(option, { selected }) => ( <React.Fragment> <Checkbox icon={icon} checkedIcon={checkedIcon} style={{ marginRight: 8 }} checked={selected} /> {option} </React.Fragment> )} style={{ width: 500 }} renderInput={(params) => ( <TextField {...params} variant="outlined" label="Checkboxes" placeholder="Favorites" /> )} /> </div> ); } export default App Run the application using the following commandnpm startOutput: Now open your browser and go to http://localhost:3000/, you will see the following output:How To Use Checkboxes in ReactJS Comment More infoAdvertise with us Next Article How To Use Checkboxes in ReactJS? G gouravhammad Follow Improve Article Tags : Technical Scripter JavaScript Web Technologies ReactJS Similar Reads How To Use ComboBox in ReactJS? When developing React applications, creating user-friendly forms with dropdowns or select inputs is common. However, sometimes you need more than just a static dropdown listâyou need a ComboBox. A ComboBox combines the functionality of a dropdown and an input field, allowing users to either select f 2 min read How To Get Multiple Checkbox Values In ReactJS? Handling checkboxes in ReactJS becomes important when creating forms or managing user input. If you need to select multiple options, we can do it by implementing multiple checkboxes. In this article, we'll explore how to get the values of multiple checkboxes in ReactJS, manage the state, and display 4 min read How to use Collapse Component in ReactJS ? ReactJS, a popular JavaScript library for building user interfaces, provides developers with a rich set of components to create interactive and dynamic web applications. One such component is the Collapse component, which allows you to hide and reveal content based on user interaction. In this artic 2 min read ReactJS Semantic UI Checkbox Module Semantic UI is a modern framework used in developing seamless designs for the website, It gives the user a lightweight experience with its components. It uses the predefined CSS, JQuery language to incorporate in different frameworks. In this article, we will know how to use Checkbox Module in React 3 min read React Suite Checkbox Group React Suite is an open-source front-end library that comes with a set of React components to make it easier for developers to develop a scalable and responsive website. In this article, we will be seeing React Suite Checkbox Group. The CheckboxGroup component is used to group similar checkboxes toge 3 min read Like