### Field Component Example Source: https://base-ui.com/react/components/field A basic example demonstrating the usage of the Field component. ```typescript 1bd:[["$","$L6f","pre-0",{"children":["$","code","code-0",{"children":["$","span","span-0",{"className":"frame","data-lined":"","children":["$","span","span-0",{"className":"line","data-ln":1,"children":["$","span","span-0",{"className":"pl-en","children":["TransitionStatus"]}]}]}]}]}] ``` -------------------------------- ### ValidationMode Example: onSubmit Source: https://base-ui.com/react/components/field Example of setting the validationMode to 'onSubmit'. ```ts 'onSubmit' ``` -------------------------------- ### React Input Component Example Source: https://base-ui.com/react/components/input Demonstrates the basic usage of the Input component within a React application. This example shows how to render a simple input field. ```typescript self.__next_f.push([1, "7V3dbptQDH4VFKnTJjVR+GszdlNp6lNsvWCBBhQSEGxNuynvPp9DtK1LQ0wDPqbxZVsanGNj+/v8cc6fHlm3tJf/tsYn9ey7LnKHAFQ+Vo33Ps7QZj/7fQmPEiyeuv4hrVJ4AkfbDu3SjexfYGJ3+NkAJqCfH90d+Mj/UMhEV+7RFi4/dIn1q/HPX9ewMp2uhoMz3bJOvbFeqrmtbp0CPMKuGTwyRRY+Na5K0LFxD1jj7rP4sdGyT8TedJl7Uy0YVNkSUjYkKp5OnefZj1WzbdRu9Zi7VfdRY1VtKr4Pal1YWfnVZ+7XRVhQ+hPwYFvHTieO/9zEV1uxxN6zjFesouiKe9KHDnxcpT+hq2MeS7Prsw+ma+bBpGFREitAzTycbElNwWwIqWkzhGi6nk5ZefYjc89CF5+XR3yaL7N58t54nvAm5HniopmEMF6JB2Ve/+6K4kXjinygfvrtKc5wdedTl2rv3ocIvL3Uc2Mo96yA1A2bQ7jbrIM3DRjgexgdgzYB0uO4ggkGfBhLyB6F5bI56Mm5UhtNlrIue4YcukmAIDqxhzk5l7w4o+hz2IBmZLfUwYwkFcntQpJivZSWQ1QKwWxIC0d4zYZs7mQATJUVsQRSEZ4p7xvMwmF0C2aywm42d1hehFFE7NQ3iFLoYSU3+snmzlKsQKiXks5BO49zap86SOhpsCjppF+CpAl0LuLaFq5FI3ujruU+d6DO+kVzd2Oq+apy0BE2WyYEsBDAQgC/KlVz1w1u0uh7wj1Tk8cRtwbd4S5YHITSwDn7MOIukNQ6g/twlWZMlczpOonLlJc60uEujxRh25ByBHeZpCjbBhVO3Gcjw5G2ecykbQ738Yh6v3EB72quo1rH8Xbn/R07VkSLwlkJZ3WunJVrULToimjxhNcL10/jot6X5EhynMPWJlVMrwx0+SsDhwJWycdX3JCFi+ZEBaoioOrZI1UXTY5SSz1dg1JPl5YOQkfPDaYOv6TiDyylmDdQ+tBEiAUbcSn9RGDZxaOlx/OWBonkTwQa4HfkffVP/WD7Gg0qNHZhTa0p9Nz0bTUaVVvQn8FXCsx43UMLx6jzoIcEB33kQY92kN/iSXjXUeFGS/CDAHYamsdJnh0TeZEnWY9/Tzgc7sr3J1fCXQl3NSTuykM28b2UCPQcXtgreeW249hDwzQpfahdRCYzKX1S+gZV+loQDOTIDc0kkFuGROV9NAw+7StarDFlvdsxKzDpo2eRxiqq3tQajBbdtbxpJaoVaX/OuP3x+UsLdtl6nOuTNJgn7TG392PJAwrJJffSGaJn0UIlCZXUcey1oDGNp1LRdbfxbAuSkBqH+2j2gtwyJHdx3K677e7cT33qZw5HTKmt9eD+/gzukMMJhkV9qk+gzlO8HIVFkaVxdLuG05fgQCa48Msorn/4DCcY3q6KJKzSCgJy+xs="]) self.__next_f.push([1, "14:[\"$\",\"$1\",\"c\",{\"children\":[[[\"$\",\"$L3c\",null,{\"children\":[[\"$\",\"$L3d\",null,{\"children\":\"Input\"}],[\"$\",\"$L3e\",null,{\"children\":[[\"$\",\"$L3f\",null,{\"children\":[[\"$\",\"$L40\",null,{\"href\":\"#\",\"children\":\"(Top)\"}]], [\"$\",\"$L3e\",null,{}] ] } ], [\"$\",\"$L3f\",null,{\"children\":[[\"$\",\"$L40\",null,{\"href\":\"#usage-guidelines\",\"children\":\"Usage guidelines\"}]], [\"$\",\"$L3e\",null,{}] ] } ], [\"$\",\"$L3f\",null,{\"children\":[[\"$\",\"$L40\",null,{\"href\":\"#anatomy\",\"children\":\"Anatomy\"}]], [\"$\",\"$L3e\",null,{}] ] } ], [\"$\",\"$L3f\",null,{\"children\":[[\"$\",\"$L40\",null,{\"href\":\"#api-reference\",\"children\":\"API reference\"}]], [\"$\",\"$L3e\",null,{}] ] } ] ] } ], [\"$\",\"$L41\",null,{\"children\":[[\"$\",\"h1\",null,{\"className\":\"MdH1\",\"id\":\"input\",\"children\":\"Input\"}], \"\\n\", [\"$\",\"div\",null,{\"className\":\"Subtitle MdSubtitle\",\"children\":[[\"$\",\"p\",null,{\"children\":[\"A native input element that automatically works with \",[\"$\",\"$L9\",null,{\"href\":\"/react/components/field\",\"className\":\"Link\",\"children\":\"Field\"}],\".\" ]}], [\"$\",\"$L42\",null,{}] ] } ], \"\\n\",null,\"\\n\", [\"$\",\"$L43\",null,{\"url\":\"file:///opt/build/repo/docs/src/app/(docs)/react/components/input/demos/hero/index.ts\",\"code\":\"$undefined\",\"precompute\":{\"CssModules\":{\"url\":\"file:///opt/build/repo/docs/src/app ``` -------------------------------- ### Field Component Hero Example Source: https://base-ui.com/react/components/field Demonstrates the basic usage of the Field component. This example uses CSS Modules for styling. ```tsx import React from 'react'; import Field from '@base-ui/react/field'; export default function Hero() { return ( } /> ); } ``` -------------------------------- ### Checkbox Hero Example Source: https://base-ui.com/react/components/checkbox Demonstrates the basic usage of the Checkbox component. ```tsx import { Checkbox } from "@mui/base/Checkbox"; export default function CheckboxIntroduction() { return ; } ``` -------------------------------- ### CheckboxGroup Nested Example Source: https://base-ui.com/react/components/checkbox-group Example showcasing a nested CheckboxGroup structure. ```typescript boolean | undefined ``` -------------------------------- ### Checkbox Group Hero Example (CSS Modules) Source: https://base-ui.com/react/components/checkbox-group Demonstrates the Checkbox Group component using CSS Modules for styling. This example showcases the basic integration and usage within a React application. ```tsx import React from 'react'; import { CheckboxGroup, CheckboxGroupProps, } from '@base-ui/react/checkbox-group'; import { Checkbox, CheckboxProps, } from '@base-ui/react/checkbox'; const CssModules = ({ className, ...props }: CheckboxGroupProps) => ( Option 1 Option 2 Option 3 ); export default CssModules; ``` ```css .container { display: flex; flex-direction: column; gap: 0.5rem; } ``` -------------------------------- ### CheckboxGroup Parent Example Source: https://base-ui.com/react/components/checkbox-group Example demonstrating how to use CheckboxGroup with a parent checkbox to manage group selection. ```typescript string[] | undefined ``` -------------------------------- ### Field Validity Usage Example Source: https://base-ui.com/react/components/field Example of using Field.Validity to render content based on the field's validity state. ```typescript Field.Validity { (state: Field.Validity.State) => React.ReactNode; } ``` -------------------------------- ### Field Functionality Example Source: https://base-ui.com/react/components/field Provides an example of a function that can be associated with field actions, such as validation. ```typescript actions: FieldRootActions = { validate: () => void } ``` -------------------------------- ### Field Class Name Function Example Source: https://base-ui.com/react/components/field Example of a function that returns a CSS class based on the field's state. ```typescript | ReactElement | (( props: HTMLProps, state: Field.Root.State, ) => ReactElement) ``` -------------------------------- ### Checkbox with Custom Indicator and State Source: https://base-ui.com/react/components/checkbox Demonstrates a checkbox with a custom indicator and how its state is managed. This example uses CSS modules for styling. ```jsx ("$", "label", null, { "className": "css-modules_Label__mzO8t", "children": [ ("$", "$L6b", null, { "defaultChecked": true, "className": "css-modules_Checkbox___OcFK", "children": [ ("$", "$L6c", null, { "className": "css-modules_Indicator__8Dw4b", "children": [ ("$", "svg", null, { "width": "16", "height": "16", "viewBox": "0 0 16 16", "fill": "none", "stroke": "currentColor", "style": { "display": "block" }, "children": [ ("$", "path", null, { "d": "m2.5 8.5 4 4 7-9" }) ] }) ] }) ] }), "Enable notifications" ] }) ``` -------------------------------- ### Field Validity State Example Source: https://base-ui.com/react/components/field Demonstrates how to use the 'validity' state for a field. This is useful for indicating whether the field's input is valid or not. ```typescript validity: boolean ``` -------------------------------- ### Checkbox Group Hero Example (Tailwind CSS) Source: https://base-ui.com/react/components/checkbox-group Illustrates the Checkbox Group component styled with Tailwind CSS utility classes. This example highlights a different approach to styling for rapid UI development. ```tsx import React from 'react'; import { CheckboxGroup, CheckboxGroupProps, } from '@base-ui/react/checkbox-group'; import { Checkbox, CheckboxProps, } from '@base-ui/react/checkbox'; const Tailwind = ({ className, ...props }: CheckboxGroupProps) => ( Option 1 Option 2 Option 3 ); export default Tailwind; ``` -------------------------------- ### Checkbox Indicator State Example Source: https://base-ui.com/react/components/checkbox Demonstrates the Checkbox.Indicator component, often used to visually represent the state of a checkbox. This example shows its integration within a JSX structure. ```tsx
" "notifications-checkbox " nativeButton render={ < button / > >
<Checkbox.Indicator /> Checkbox.Root> div> ``` -------------------------------- ### Field Render Prop Example Source: https://base-ui.com/react/components/field Illustrates the 'render' prop for the Field component, showing how to control the rendered element and its behavior. It explains when to use 'false' for 'render' to prevent inheriting label behaviors. ```tsx