UNPKG

@amsterdam/design-system-react

Version:

All React components from the Amsterdam Design System. Use it to compose pages in your website or application.

13 lines (12 loc) 617 B
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime"; /** * @license EUPL-1.2+ * Copyright Gemeente Amsterdam */ import clsx from 'clsx'; import { forwardRef, useId } from 'react'; export const Switch = forwardRef(({ className, id, ...restProps }, ref) => { const inputId = id || useId(); return (_jsxs("div", { className: clsx('ams-switch', className), children: [_jsx("input", { ...restProps, className: "ams-switch__input", id: inputId, ref: ref, role: "switch", type: "checkbox" }), _jsx("label", { className: "ams-switch__label", htmlFor: inputId })] })); }); Switch.displayName = 'Switch';