# Code

### Props

<table><thead><tr><th>Props</th><th width="380.66666666666663">Data Type</th><th>Required</th></tr></thead><tbody><tr><td>className</td><td>string</td><td><span data-gb-custom-inline data-tag="emoji" data-code="274c">❌</span></td></tr><tr><td>type</td><td>'Checkbox' | 'Radio'</td><td><span data-gb-custom-inline data-tag="emoji" data-code="274c">❌</span></td></tr><tr><td>style</td><td>'List' | 'Grid'</td><td><span data-gb-custom-inline data-tag="emoji" data-code="274c">❌</span></td></tr><tr><td>listGap</td><td>number</td><td><span data-gb-custom-inline data-tag="emoji" data-code="274c">❌</span></td></tr><tr><td>gridColumns</td><td>number</td><td><span data-gb-custom-inline data-tag="emoji" data-code="274c">❌</span></td></tr><tr><td>gridXGap</td><td>number</td><td><span data-gb-custom-inline data-tag="emoji" data-code="274c">❌</span></td></tr><tr><td>gridYGap</td><td>number</td><td><span data-gb-custom-inline data-tag="emoji" data-code="274c">❌</span></td></tr><tr><td>gridGap</td><td>number</td><td><span data-gb-custom-inline data-tag="emoji" data-code="274c">❌</span></td></tr><tr><td>children</td><td>SelectionItem component</td><td><span data-gb-custom-inline data-tag="emoji" data-code="274c">❌</span></td></tr><tr><td>onChange</td><td>function event</td><td><span data-gb-custom-inline data-tag="emoji" data-code="274c">❌</span></td></tr></tbody></table>

### Description

The `SelectionList` component basically works as the `ChecboxGroup` and `RadioGroup` components, allowing developers to select which type of behavior they prefer for the listed elements (`Checkbox` allows multiple selections, while the `Radio` type only allows one single selection at the time).&#x20;

This component offers the extra feature of adding visual indicators like icons or adding descriptions to the listed elements, offering more information to users.

### Radio Type Variant

Something developers should keep in mind, is that the `Radio` type variant of the `SelectionList` component, is that it allows to show nested content inside the option. So, besides the title, icon and description that can be added to the element, developers have the extra feature of adding nested content that only is going to be displayed when user selects the specific option, like if it was an accordion component.

![](/files/mdmjSf2zyKbdDSYZC4lU)Standard Checkbox type for the `SelectionList`

![](/files/eOXSAtqw24BIkQfcgWTS)`Radio` type showing the nested content.

### Children

To generate the structure required for the menu, the developer is able to insert the following components as children elements:

#### SelectionItem

<table><thead><tr><th>Props</th><th width="380.66666666666663">Data Type</th><th>Required</th></tr></thead><tbody><tr><td>id</td><td>string</td><td><span data-gb-custom-inline data-tag="emoji" data-code="2705">✅</span></td></tr><tr><td>name</td><td>string</td><td><span data-gb-custom-inline data-tag="emoji" data-code="274c">❌</span></td></tr><tr><td>value</td><td>string</td><td><span data-gb-custom-inline data-tag="emoji" data-code="2705">✅</span></td></tr><tr><td>defaultChecked</td><td>boolean</td><td><span data-gb-custom-inline data-tag="emoji" data-code="274c">❌</span></td></tr><tr><td>title</td><td>string</td><td><span data-gb-custom-inline data-tag="emoji" data-code="274c">❌</span></td></tr><tr><td>description</td><td>string</td><td><span data-gb-custom-inline data-tag="emoji" data-code="274c">❌</span></td></tr><tr><td>icon</td><td>Available Telicon Icons</td><td><span data-gb-custom-inline data-tag="emoji" data-code="274c">❌</span></td></tr><tr><td>type</td><td>'Checkbox' | 'Radio'</td><td><span data-gb-custom-inline data-tag="emoji" data-code="274c">❌</span></td></tr><tr><td>disabled</td><td>boolean</td><td><span data-gb-custom-inline data-tag="emoji" data-code="274c">❌</span></td></tr><tr><td>children</td><td>any</td><td><span data-gb-custom-inline data-tag="emoji" data-code="274c">❌</span></td></tr></tbody></table>

### Style

Style prop is going to change the visual distribution of the `SelectionList` component, from a column (Default list style) to a row (Grid style). Besides that, developers can control the gaps between elements using the props `listGap`, `gridGap`, `gridYGap` and `gridXGap`. Finally, in the case developers are using the `Grid` style for the `SelectionList` component, they can also control the number of columns to show with `gridColumns` prop.

### Code

```tsx
<SelectionList
  className="SelectionListExample"
  onChange={changeEvent}
  style="List"
  type="Checkbox"
>
  <SelectionItem
    description="Lorem Ipsum"
    id="example1"
    name="example"
    title="Example 1"
    value="example1"
  >
    <p>
      Lorem ipsum dolor sit, amet consectetur adipisicing elit. In explicabo vitae, maxime voluptas repudiandae facilis! Eius amet aspernatur repellendus distinctio vel esse, consectetur nisi repudiandae, saepe animi, sit reprehenderit fuga.
    </p>
  </SelectionItem>
  <SelectionItem
    description="Lorem Ipsum"
    id="example2"
    name="example"
    title="Example 2"
    value="example2"
  >
    <p>
      Lorem ipsum dolor sit, amet consectetur adipisicing elit. In explicabo vitae, maxime voluptas repudiandae facilis!
    </p>
  </SelectionItem>
  <SelectionItem
    description="Lorem Ipsum"
    id="example3"
    name="example"
    title="Example 3"
    value="example3"
  >
    <p>
      Lorem ipsum dolor sit, amet consectetur adipisicing elit.
    </p>
  </SelectionItem>
</SelectionList>
```

## Components Dependency

For this component elaboration, there were used the following internal components:

* [Telicon](/sds/sds-components/simple-components/telicon.md)
* [Text](/sds/sds-components/simple-components/text.md)

## Live Demo

For detailed code usage documentation, see the Storybooks for each framework below.

### React

{% embed url="<https://sipster-react-component-storybook.netlify.app/?path=/story/form-controls-selection-list--base-selection-list&args=type:Radio>" %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://2600hz.gitbook.io/sds/sds-components/form-controls/selection-list/code.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
