@amsterdam/design-system-react
Version:
All React components from the Amsterdam Design System. Use it to compose pages in your website or application.
12 lines (11 loc) • 695 B
JavaScript
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { clsx } from 'clsx';
import { forwardRef, useId } from 'react';
/**
* @see {@link https://designsystem.amsterdam/?path=/docs/components-forms-switch--docs Switch docs at Amsterdam Design System}
*/
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';