Input - Develop

The Input component encompasses various text input types, including radio buttons and checkboxes.

Inputs are essential components in web development, used for user interactions. Inputs can have an error or success state to provide feedback to the user.

Keep in mind that the <input> element inherently includes native browser properties like onChange. Additionally, Cherry UI components introduce custom properties that always begin with a $ to distinguish them from native component props.

import React from "react"; import { Input } from "cherry-styled-components"; export default function Page() { return ( <Input type="text" placeholder="Placeholder"> ) }
TextDefault

You can add a label by adding a $label prop.

import React from "react"; import { Input } from "cherry-styled-components"; export default function Page() { return <Input type="text" $label="Username" $fullWidth />; }
TextFull width with Label

Here is an example of a checkbox and a radio:

import React from "react"; import { Input } from "cherry-styled-components"; export default function Page() { return ( <Input type="checkbox" defaultChecked /> <Input type="radio" /> ) }
CheckboxdefaultChecked
RadioDefault

Properties

PropertyDescription
type"text" | "checkbox" | "radio"
$label?string
$size?"default" | "big"
$error?boolean
$success?boolean
$fullWidth?boolean
theme?Theme

Explore the source code on GitHub: