diff options
| author | Oliver <oliver@mohlin.dev> | 2025-09-15 15:30:12 +0200 |
|---|---|---|
| committer | Tobias Järvelöv <tobias.jarvelov@mullvad.net> | 2025-09-22 12:35:44 +0200 |
| commit | e3203d51e5c76dde57f03cd5487bc8d872d3f4e9 (patch) | |
| tree | 6c17ee05379362abb52c437ec8dfe9e1911c449d | |
| parent | 26fc0ed79408ed2f0b6251b2711f10dd4b9b91e8 (diff) | |
| download | mullvadvpn-e3203d51e5c76dde57f03cd5487bc8d872d3f4e9.tar.xz mullvadvpn-e3203d51e5c76dde57f03cd5487bc8d872d3f4e9.zip | |
Add labelId prop to Switch component
| -rw-r--r-- | desktop/packages/mullvad-vpn/src/renderer/lib/components/switch/Switch.tsx | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/desktop/packages/mullvad-vpn/src/renderer/lib/components/switch/Switch.tsx b/desktop/packages/mullvad-vpn/src/renderer/lib/components/switch/Switch.tsx index df90c19bd8..8fe92377c9 100644 --- a/desktop/packages/mullvad-vpn/src/renderer/lib/components/switch/Switch.tsx +++ b/desktop/packages/mullvad-vpn/src/renderer/lib/components/switch/Switch.tsx @@ -6,15 +6,22 @@ import { SwitchProvider } from './SwitchContext'; export interface SwitchProps { checked?: boolean; onCheckedChange?: (checked: boolean) => void; + labelId?: string; disabled?: boolean; children: React.ReactNode; } -function Switch({ checked, onCheckedChange, disabled, children }: SwitchProps) { +function Switch({ + labelId: labelIdProp, + checked, + onCheckedChange, + disabled, + children, +}: SwitchProps) { const labelId = React.useId(); return ( <SwitchProvider - labelId={labelId} + labelId={labelIdProp ?? labelId} checked={checked} onCheckedChange={onCheckedChange} disabled={disabled}> |
