chakra-ui / ark

A headless library for building reusable, scalable design systems that works for a wide range of JS frameworks.

Home Page:https://ark-ui.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ToggleGroup: add an option to prevent empty selected items

vladstudio opened this issue · comments

Description

See the demo at https://ark-ui.com/docs/components/toggle-group – the first button is initially selected, but if you click it, it becomes unselected. In other words, the component value becomes [].

Can it become an optional behaviour? I expected one item to be always selected by default: clicking a selected item would do nothing.

Link to Reproduction (or Detailed Explanation)

https://ark-ui.com/docs/components/toggle-group

Steps to Reproduce

  1. Go to https://ark-ui.com/docs/components/toggle-group
  2. Note how the first button is selected
  3. Click it
  4. The ToggleGroup now has zero selected items

Ark UI Version

latest (2.2.3)

Framework

  • React
  • Solid
  • Vue

Browser

Chrome

Additional Information

No response