diff --git a/apps/website/pages/components/toggle-group/code.tsx b/apps/website/pages/components/toggle-group/code.tsx
new file mode 100644
index 0000000000..7056fd0a90
--- /dev/null
+++ b/apps/website/pages/components/toggle-group/code.tsx
@@ -0,0 +1,17 @@
+import Head from "next/head";
+import type { ReactElement } from "react";
+import ToggleGroupPageLayout from "screens/components/toggle-group/ToggleGroupPageLayout";
+import ToggleGroupCodePage from "screens/components/toggle-group/code/ToggleGroupCodePage";
+
+const Code = () => (
+ <>
+
+ Toggle group code — Halstack Design System
+
+
+ >
+);
+
+Code.getLayout = (page: ReactElement) => {page};
+
+export default Code;
diff --git a/apps/website/pages/components/toggle-group/index.tsx b/apps/website/pages/components/toggle-group/index.tsx
index 57fd486e43..e22f16103c 100644
--- a/apps/website/pages/components/toggle-group/index.tsx
+++ b/apps/website/pages/components/toggle-group/index.tsx
@@ -1,21 +1,17 @@
import Head from "next/head";
import type { ReactElement } from "react";
import ToggleGroupPageLayout from "screens/components/toggle-group/ToggleGroupPageLayout";
-import ToggleGroupCodePage from "screens/components/toggle-group/code/ToggleGroupCodePage";
+import ToggleGroupOverviewPage from "screens/components/toggle-group/overview/ToggleGroupOverviewPage";
-const Index = () => {
- return (
- <>
-
- Toggle Group — Halstack Design System
-
-
- >
- );
-};
+const Index = () => (
+ <>
+
+ Toggle Group — Halstack Design System
+
+
+ >
+);
-Index.getLayout = function getLayout(page: ReactElement) {
- return {page};
-};
+Index.getLayout = (page: ReactElement) => {page};
export default Index;
diff --git a/apps/website/pages/components/toggle-group/specifications.tsx b/apps/website/pages/components/toggle-group/specifications.tsx
deleted file mode 100644
index 07a9ecac8d..0000000000
--- a/apps/website/pages/components/toggle-group/specifications.tsx
+++ /dev/null
@@ -1,21 +0,0 @@
-import Head from "next/head";
-import type { ReactElement } from "react";
-import ToggleGroupPageLayout from "screens/components/toggle-group/ToggleGroupPageLayout";
-import ToggleGroupSpecsPage from "screens/components/toggle-group/specs/ToggleGroupSpecsPage";
-
-const Specifications = () => {
- return (
- <>
-
- Toggle Group Specs — Halstack Design System
-
-
- >
- );
-};
-
-Specifications.getLayout = function getLayout(page: ReactElement) {
- return {page};
-};
-
-export default Specifications;
diff --git a/apps/website/pages/components/toggle-group/usage.tsx b/apps/website/pages/components/toggle-group/usage.tsx
deleted file mode 100644
index df03c22448..0000000000
--- a/apps/website/pages/components/toggle-group/usage.tsx
+++ /dev/null
@@ -1,21 +0,0 @@
-import Head from "next/head";
-import type { ReactElement } from "react";
-import ToggleGroupPageLayout from "screens/components/toggle-group/ToggleGroupPageLayout";
-import ToggleGroupUsagePage from "screens/components/toggle-group/usage/ToggleGroupUsagePage";
-
-const Usage = () => {
- return (
- <>
-
- ToggleGroup Usage — Halstack Design System
-
-
- >
- );
-};
-
-Usage.getLayout = function getLayout(page: ReactElement) {
- return {page};
-};
-
-export default Usage;
diff --git a/apps/website/screens/components/container/code/examples/listbox.ts b/apps/website/screens/components/container/code/examples/listbox.ts
index 00953231f0..19d00ad1bc 100644
--- a/apps/website/screens/components/container/code/examples/listbox.ts
+++ b/apps/website/screens/components/container/code/examples/listbox.ts
@@ -9,8 +9,8 @@ const code = `() => {
background={{ color: "var(--border-color-neutral-brighter)" }}
border={{
color: "var(--border-color-neutral-medium)",
- width: "var(--border-width-s)",
- style: "var(--border-style-default)"
+ style: "var(--border-style-default)",
+ width: "var(--border-width-s)"
}}
borderRadius="var(--border-radius-s)"
boxShadow="var(--shadow-mid-x-position) var(--shadow-mid-y-position) var(--shadow-mid-blur) var(--shadow-mid-spread) var(--shadow-light)"
diff --git a/apps/website/screens/components/contextual-menu/overview/ContextualMenuOverviewPage.tsx b/apps/website/screens/components/contextual-menu/overview/ContextualMenuOverviewPage.tsx
index b2e4195fbf..dafe0021a7 100644
--- a/apps/website/screens/components/contextual-menu/overview/ContextualMenuOverviewPage.tsx
+++ b/apps/website/screens/components/contextual-menu/overview/ContextualMenuOverviewPage.tsx
@@ -3,7 +3,7 @@ import DocFooter from "@/common/DocFooter";
import QuickNavContainer from "@/common/QuickNavContainer";
import QuickNavContainerLayout from "@/common/QuickNavContainerLayout";
import Image from "@/common/Image";
-import anatomy from "./images/contextual-menu_anatomy.png";
+import anatomy from "./images/contextual_menu_anatomy.png";
const sections = [
{
diff --git a/apps/website/screens/components/contextual-menu/overview/images/contextual-menu_anatomy.png b/apps/website/screens/components/contextual-menu/overview/images/contextual_menu_anatomy.png
similarity index 100%
rename from apps/website/screens/components/contextual-menu/overview/images/contextual-menu_anatomy.png
rename to apps/website/screens/components/contextual-menu/overview/images/contextual_menu_anatomy.png
diff --git a/apps/website/screens/components/toggle-group/ToggleGroupPageLayout.tsx b/apps/website/screens/components/toggle-group/ToggleGroupPageLayout.tsx
index e38d6e79d9..7a6858bdbe 100644
--- a/apps/website/screens/components/toggle-group/ToggleGroupPageLayout.tsx
+++ b/apps/website/screens/components/toggle-group/ToggleGroupPageLayout.tsx
@@ -6,26 +6,21 @@ import { ReactNode } from "react";
const ToggleGroupPageHeading = ({ children }: { children: ReactNode }) => {
const tabs = [
- { label: "Code", path: "/components/toggle-group" },
- { label: "Usage", path: "/components/toggle-group/usage" },
- {
- label: "Specifications",
- path: "/components/toggle-group/specifications",
- },
+ { label: "Overview", path: "/components/toggle-group" },
+ { label: "Code", path: "/components/toggle-group/code" },
];
return (
-
+
- Toggle buttons can be used to put together related options that share a common attribute modification. It
- allows the user to switch from one selected option to another in the same control, having one option
- selected at a time. Also, there can be another variation that allows selecting multiple options from the
- current toggle group.
+ The toggle group component is a set of toggle buttons that function as a unified control, allowing users to
+ make either single or multiple selections. It is ideal for grouping related actions or options within a
+ compact and interactive interface.
-
+
{children}
diff --git a/apps/website/screens/components/toggle-group/code/ToggleGroupCodePage.tsx b/apps/website/screens/components/toggle-group/code/ToggleGroupCodePage.tsx
index 86c4ef9c8c..b9ea54743a 100644
--- a/apps/website/screens/components/toggle-group/code/ToggleGroupCodePage.tsx
+++ b/apps/website/screens/components/toggle-group/code/ToggleGroupCodePage.tsx
@@ -1,4 +1,4 @@
-import { DxcFlex, DxcLink, DxcTable } from "@dxc-technology/halstack-react";
+import { DxcFlex, DxcTable } from "@dxc-technology/halstack-react";
import QuickNavContainerLayout from "@/common/QuickNavContainerLayout";
import QuickNavContainer from "@/common/QuickNavContainer";
import Code from "@/common/Code";
@@ -7,7 +7,16 @@ import Example from "@/common/example/Example";
import controlled from "./examples/controlled";
import uncontrolled from "./examples/uncontrolled";
import StatusBadge from "@/common/StatusBadge";
-import TableCode from "@/common/TableCode";
+import TableCode, { ExtendedTableCode } from "@/common/TableCode";
+
+const optionTypeString = `{
+ disabled?: boolean;
+ icon?: string |
+ (React.ReactNode
+ & React.SVGProps);
+ label?: string;
+ value: string;
+}`;
const sections = [
{
@@ -32,81 +41,16 @@ const sections = [
-
-
value
-
- number | number[]
-
-
- The key(s) of the selected value(s). If the toggle group component doesn't allow multiple selection, it
- must be one unique value. If the component allows multiple selection, value must be an array. If
- undefined, the component will be uncontrolled and the value will be managed internally by the component.
-
- An array of objects representing the selectable options. Each object has the following properties:
-
-
- label: String with the option display value.
-
-
- icon:{" "}
-
- Material Symbol
- {" "}
- name or SVG element used as the icon of an option.
-
-
- value: Number with the option inner value.
-
-
- title: Text representing advisory information related to an option. Under the hood, it also
- serves as an accessible label for the icon.
-
-
+ Size of the margin to be applied to the component. You can pass an object with 'top', 'bottom', 'left' and
+ 'right' properties in order to specify different margin sizes.
- Size of the margin to be applied to the component. You can pass an object with 'top', 'bottom', 'left' and
- 'right' properties in order to specify different margin sizes.
+ Option[]
+
+ being Option an object with the following properties:
+
+ {optionTypeString}
+
An array of objects representing the selectable options.
-
+
+
orientation
+
+ 'horizontal' | 'vertical'
+
+
The orientation of the toggle group.
+
+ 'horizontal'
+
+
tabIndex
@@ -155,6 +115,18 @@ const sections = [
0
+
+
value
+
+ number | number[]
+
+
+ The key(s) of the selected value(s). If the toggle group component doesn't allow multiple selection, it
+ must be one unique value. If the component allows multiple selection, value must be an array. If
+ undefined, the component will be uncontrolled and the value will be managed internally by the component.
+
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit.
+
+
+
);
}`;
const scope = {
- DxcToggleGroup,
+ DxcContainer,
+ DxcFlex,
DxcInset,
+ DxcToggleGroup,
+ useRef
};
export default { code, scope };
diff --git a/apps/website/screens/components/toggle-group/overview/ToggleGroupOverviewPage.tsx b/apps/website/screens/components/toggle-group/overview/ToggleGroupOverviewPage.tsx
new file mode 100644
index 0000000000..ee6c7994db
--- /dev/null
+++ b/apps/website/screens/components/toggle-group/overview/ToggleGroupOverviewPage.tsx
@@ -0,0 +1,194 @@
+import { DxcParagraph, DxcBulletedList, DxcFlex } from "@dxc-technology/halstack-react";
+import QuickNavContainer from "@/common/QuickNavContainer";
+import DocFooter from "@/common/DocFooter";
+import QuickNavContainerLayout from "@/common/QuickNavContainerLayout";
+import Example from "@/common/example/Example";
+import Code from "@/common/Code";
+import Image from "@/common/Image";
+import anatomy from "./images/toggle_group_anatomy.png";
+import singleSelection from "./examples/singleSelection";
+import multipleSelection from "./examples/multipleSelection";
+import orientation from "./examples/orientation";
+
+const sections = [
+ {
+ title: "Introduction",
+ content: (
+
+ The toggle group component provides a flexible way to present related options or actions within
+ a single interface. It consists of multiple toggle buttons, allowing users to make either single or multiple
+ selections depending on the configuration. This component is particularly useful for settings, filtering
+ options, or mode switching, where users need to quickly toggle between states. By grouping
+ these actions together, it enhances usability and keeps the interface organized, ensuring a seamless interaction
+ experience.
+
+ ),
+ },
+ {
+ title: "Anatomy",
+ content: (
+ <>
+
+
+
+ Container: the structural wrapper that holds all toggle buttons together.
+
+
+ Icon: an optional visual element within a toggle button that helps users quickly identify
+ its function or meaning.
+
+
+ Label: the textual representation inside each toggle button, describing its function or
+ selection state.
+
+
+ Toggle button(selected): a button in an active state, indicating that the user
+ has chosen this option.
+
+
+ Toggle button(unselected): a button in its default or inactive state. It remains
+ visually subdued compared to the selected button but is still clearly visible and interactive, allowing
+ users to switch selections easily.
+
+
+ >
+ ),
+ },
+ {
+ title: "Variants",
+ content: (
+
+ Depending on the number of actions or options the user can select on a toggle group, there are two different
+ variants of the component.
+
+ ),
+ subSections: [
+ {
+ title: "Single selection",
+ content: (
+
+ The single selection variant allows users to select{" "}
+ only one option at a time. When a new option is selected, the previous one is automatically
+ deselected. This variant is ideal for scenarios where users need to toggle between mutually exclusive
+ options, ensuring clarity and preventing conflicting selections.
+
+ ),
+ subSections: [
+ {
+ title: "Use cases",
+ content: (
+ <>
+
+
+ View selection: allowing users to switch between different data presentation
+ formats, such as grid view vs. list view in a product catalog.
+
+
+ Mode switching: Enabling users to toggle between modes like{" "}
+ light mode vs. dark mode in an interface.
+
+
+ Filter selection: Helping users refine content by choosing a{" "}
+ single category filter in dashboards or reports.
+
+
+
+ >
+ ),
+ },
+ ],
+ },
+ {
+ title: "Multiple selection",
+ content: (
+
+ The multiple selection variant of the toggle group component allows users to select
+ multiple options at the same time. Unlike the single selection variant, this version enables users to
+ activate or deactivate multiple toggles independently, making it useful for scenarios where multiple choices
+ can be applied simultaneously.
+
+ ),
+ subSections: [
+ {
+ title: "Use cases",
+ content: (
+ <>
+
+
+ Formatting options: enabling users to apply bold,{" "}
+ italic, and underline text styles simultaneously in a text editor.
+
+
+ Risk assessment options: underwriters can enable multiple risk factors when
+ evaluating a client, such as pre-existing conditions, vehicle age,
+ and past claim history.
+
+
+ Filtering: allowing users to refine searches by toggling filters like "in
+ progress", "ready to review" or "done".
+
+
+
+ >
+ ),
+ },
+ ],
+ },
+ {
+ title: "Orientation",
+ content: (
+ <>
+
+ Although not technically a variant, the toggle group can also be{" "}
+ stacked in two different ways: horizontally and vertically. Users can choose the option
+ that better fits their needs according to layout constraints.
+
+
+ >
+ ),
+ },
+ ],
+ },
+ {
+ title: "Best practices",
+ content: (
+
+
+ Choose the right selection mode: use single selection when only one option
+ can be active at a time (e.g., selecting a payment method). Use multiple selection when users
+ can activate several options simultaneously (e.g., selecting policy add-ons).
+
+
+ Group related actions logically: ensure that the toggle buttons represent actions or choices
+ that are related to each other, helping users make clear and informed selections.
+
+
+ Use appropriate labels and icons: labels should be concise and self-explanatory. If using
+ icons, ensure they clearly represent their respective actions or choices.
+
+
+ Stack options based on content needs: use a horizontal layout when there are
+ only a few options and space allows, making comparisons easier. Use a vertical layout when
+ dealing with multiple choices or longer text labels to enhance readability.
+
+
+ Be mindful of where you place the toggle group: this component is not meant to replace{" "}
+ radio buttons, checkboxes, or switches, as it does not
+ register selections as form inputs. If the user needs to provide structured answers, use the appropriate form
+ elements instead.
+
+
+ ),
+ },
+];
+
+const ToggleGroupOverviewPage = () => (
+
+
+
+
+
+
+);
+
+export default ToggleGroupOverviewPage;
diff --git a/apps/website/screens/components/toggle-group/overview/examples/multipleSelection.ts b/apps/website/screens/components/toggle-group/overview/examples/multipleSelection.ts
new file mode 100644
index 0000000000..6503e67e65
--- /dev/null
+++ b/apps/website/screens/components/toggle-group/overview/examples/multipleSelection.ts
@@ -0,0 +1,53 @@
+import { DxcInset, DxcToggleGroup } from "@dxc-technology/halstack-react";
+
+const code = `() => {
+ const options = [
+ {
+ value: 1,
+ icon: "format_bold",
+ title: "Bold",
+ },
+ {
+ value: 2,
+ icon: "format_italic",
+ title: "Italic",
+ },
+ {
+ value: 3,
+ icon: "format_underlined",
+ title: "Underlined",
+ },
+ {
+ value: 4,
+ icon: "format_align_left",
+ title: "Align left",
+ },
+ {
+ value: 5,
+ icon: "format_align_center",
+ title: "Align center",
+ },
+ {
+ value: 6,
+ icon: "format_align_right",
+ title: "Align right",
+ },
+ ];
+
+ return (
+
+
+
+ );
+}`;
+
+const scope = {
+ DxcInset,
+ DxcToggleGroup,
+};
+
+export default { code, scope };
diff --git a/apps/website/screens/components/toggle-group/overview/examples/orientation.ts b/apps/website/screens/components/toggle-group/overview/examples/orientation.ts
new file mode 100644
index 0000000000..f7b04854d5
--- /dev/null
+++ b/apps/website/screens/components/toggle-group/overview/examples/orientation.ts
@@ -0,0 +1,45 @@
+import { DxcFlex, DxcInset, DxcToggleGroup } from "@dxc-technology/halstack-react";
+
+const code = `() => {
+ const options = [
+ {
+ value: 1,
+ icon: "wifi",
+ label: "Wifi",
+ },
+ {
+ value: 2,
+ label: "Ethernet",
+ },
+ {
+ value: 3,
+ icon: "5g",
+ label: "5G",
+ },
+ ];
+
+ return (
+
+
+
+
+
+
+ );
+}`;
+
+const scope = {
+ DxcFlex,
+ DxcInset,
+ DxcToggleGroup,
+};
+
+export default { code, scope };
diff --git a/apps/website/screens/components/toggle-group/overview/examples/singleSelection.ts b/apps/website/screens/components/toggle-group/overview/examples/singleSelection.ts
new file mode 100644
index 0000000000..c427c0e1f3
--- /dev/null
+++ b/apps/website/screens/components/toggle-group/overview/examples/singleSelection.ts
@@ -0,0 +1,42 @@
+import { DxcInset, DxcToggleGroup } from "@dxc-technology/halstack-react";
+
+const code = `() => {
+ const options = [
+ {
+ value: 1,
+ label: "Not started",
+ },
+ {
+ value: 2,
+ label: "In progress",
+ },
+ {
+ value: 3,
+ label: "Ready to review",
+ },
+ {
+ value: 4,
+ label: "Completed",
+ },
+ {
+ value: 5,
+ label: "Awaiting approval",
+ },
+ ];
+
+ return (
+
+
+
+ );
+}`;
+
+const scope = {
+ DxcInset,
+ DxcToggleGroup,
+};
+
+export default { code, scope };
diff --git a/apps/website/screens/components/toggle-group/overview/images/toggle_group_anatomy.png b/apps/website/screens/components/toggle-group/overview/images/toggle_group_anatomy.png
new file mode 100644
index 0000000000..a5411c91dc
Binary files /dev/null and b/apps/website/screens/components/toggle-group/overview/images/toggle_group_anatomy.png differ
diff --git a/apps/website/screens/components/toggle-group/specs/ToggleGroupSpecsPage.tsx b/apps/website/screens/components/toggle-group/specs/ToggleGroupSpecsPage.tsx
deleted file mode 100644
index c6f672a87c..0000000000
--- a/apps/website/screens/components/toggle-group/specs/ToggleGroupSpecsPage.tsx
+++ /dev/null
@@ -1,680 +0,0 @@
-import { DxcTable, DxcParagraph, DxcBulletedList, DxcFlex } from "@dxc-technology/halstack-react";
-import Image from "@/common/Image";
-import QuickNavContainer from "@/common/QuickNavContainer";
-import QuickNavContainerLayout from "@/common/QuickNavContainerLayout";
-import Figure from "@/common/Figure";
-import Code from "@/common/Code";
-import DocFooter from "@/common/DocFooter";
-import toggleGroupAnatomy from "./images/toggle_group_anatomy.png";
-import toggleGroupStates from "./images/toggle_group_states.png";
-import toggleGroupSpecs from "./images/toggle_group_specs.png";
-
-const sections = [
- {
- title: "Specifications",
- content: (
-
-
-
- ),
- },
- {
- title: "States",
- content: (
- <>
-
- Different states are defined in the life cycle of the component: unselected enabled,{" "}
- unselected hover, unselected focus, unselected active,{" "}
- unselected disabled, selected enabled, selected hover,{" "}
- selected focus, selected active and selected disabled
-
-
-
-
- >
- ),
- },
- {
- title: "Anatomy",
- content: (
- <>
-
-
- Label
- Helper text
- Container
- Button
- Button icon
- Button label
-
- >
- ),
- },
- {
- title: "Design tokens",
- subSections: [
- {
- title: "Color",
- content: (
-
-
-