Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/components/Toggle/component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,11 @@ function Toggle ({
ariaLabel,
ariaLabelledBy,
ariaDescribedBy,
id: providedId,
...toggleProps
}: ToggleProps): JSX.Element {
const id = useId();
const generatedUniqueId = useId();
const id = providedId ?? generatedUniqueId;
const labelId = label ? `${id}-label` : undefined;
const helperTextId = helperText ? `${id}-helper` : undefined;

Expand Down
2 changes: 2 additions & 0 deletions src/components/Toggle/types.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import React from 'react';
import { TEXT_POSITIONS_VALUES } from './constants';

export type LayoutType = typeof TEXT_POSITIONS_VALUES[number];
Expand All @@ -14,6 +15,7 @@ export interface StyledTextWrapperProps extends StyledToggleWrapperProps{
}

export interface ToggleProps {
id?: string;
disabled?: boolean;
label?: string;
helperText?: string;
Expand Down