import React from "react"; import ToggleGroup from "../app/components/ToggleGroup"; export default { title: "Forms/ToggleGroup", component: ToggleGroup, parameters: { layout: "centered", }, argTypes: { position: { control: { type: "select" }, options: ["left", "middle", "right"], }, state: { control: { type: "select" }, options: ["default", "hover", "focus", "selected"], }, showText: { control: { type: "boolean" }, }, }, }; const Template = (args) => Toggle Item; export const Default = Template.bind({}); Default.args = { position: "left", state: "default", showText: true, }; export const Middle = Template.bind({}); Middle.args = { position: "middle", state: "default", showText: true, }; export const Right = Template.bind({}); Right.args = { position: "right", state: "default", showText: true, }; export const States = () => (

Toggle Group States

Default Hover Focus Selected
); export const Positions = () => (

Toggle Group Positions

Left Middle Middle Right
); export const WithText = Template.bind({}); WithText.args = { position: "left", state: "default", showText: true, children: "Active Deals", }; export const WithoutText = Template.bind({}); WithoutText.args = { position: "left", state: "default", showText: false, children: "☰", }; export const WithIcons = () => (

Toggle Group with Icons

); export const Interactive = () => { const [selectedPosition, setSelectedPosition] = React.useState("left"); const [state, setState] = React.useState("default"); const [showText, setShowText] = React.useState(true); return (

Interactive Toggle Group

setSelectedPosition("left")} ariaLabel={!showText ? "Active Deals" : undefined} > {showText ? "Active Deals" : "☰"} setSelectedPosition("middle")} ariaLabel={!showText ? "Inactive Deals" : undefined} > {showText ? "Inactive Deals" : "☰"} setSelectedPosition("right")} ariaLabel={!showText ? "Pending Deals" : undefined} > {showText ? "Pending Deals" : "☰"}

Controls

setShowText(e.target.checked)} />
); };