Обзор
Компоненты
- Accordion
- Alert
- Alert Dialog
- Autocomplete
- Auth Surface
- Avatar
- Badge
- Browse Catalog Dialog
- Button
- Card
- Checkbox
- Checkbox Group
- Collapsible
- Combobox
- Command
- Connector Setup Dialog
- Cookie Banner
- Dialog
- Directory Card
- Directory Detail
- Directory Skeleton
- DrawerНовое
- Token Parts Input
- Empty
- Field
- Fieldset
- File Preview Modal
- File Preview Skeleton
- Form
- Frame
- Group
- Icon
- Input
- Input Group
- Kbd
- Label
- Legal Shell
- Menu
- Mermaid Diagram
- Mind Map Diagram
- Not Found Screen
- Onboarding Frame
- Popover
- PDF Thumbnail
- Personalization Landing
- Preview Card
- Pricing Page
- Progress
- Radio Group
- Ring Spinner
- Scroll Area
- Select
- Separator
- Settings Page
- Settings Skills
- Settings Connectors
- Settings Capabilities
- Settings Usage
- Settings Account
- Settings Billing
- Sheet
- Sidebar
- Skeleton
- Skill Create Dialog
- Slider
- Spinner
- Stat
- Switch
- Table
- Tabs
- Textarea
- Toast
- Toggle
- Tooltip
AI-компоненты
- Компоненты AI
- Chat Conversation
- Chat Message
- Chat Response
- Chat Suggestion
- Chat Prompt Input
- Slash Highlighted Textarea
- Chat Search Dialog
- Chat Skill Doc
- Chat Connector Detail
- Chat Attachments
- Chat File Card
- Chat Token Chip
- Chat Code Block
- Chat Image
- Chat Inline Citation
- Chat Sources
- Chat Web Search
- Chat Research
- Chat Source
- Chat Actions
- Chat Context
- Chat Loader
- Chat Compaction
- Chat Timeline
- Chat Snippet
- Chat Terminal
- Chat Stack Trace
- Chat Test Results
- Chat File Tree
- Chat Environment Variables
- Chat Audio Player
- Chat Transcription
- Chat Speech Input
- Chat Mic Selector
- Chat Voice Selector
- Chat Agent
- Chat Persona
- Chat Connection
- Chat Connector Suggestion
- Chat Queue
- Chat Checkpoint
- Chat Confirmation
- Chat Artifact
- Chat JSX Preview
- Chat Schema Display
- Chat Package Info
- Chat Commit
- Chat Plan
- Chat Open In Chat
- Chat Sandbox
- Chat Model Selector
- Chat Canvas
- Chat Node
- Chat Edge
Ресурсы
Input
Нативный элемент поля ввода.
import { Input } from "@/components/ui/input";
export default function Particle() {
return (
<Input aria-label="Введите текст" placeholder="Введите текст" type="text" />
);
}
Установка
pnpm dlx shadcn@latest add @oracul/input
Использование
import { Input } from "@/components/ui/input"<Input />Справочник API
Input
Стилизованная обёртка для Input из Base UI с настраиваемыми вариантами размера.
| Свойство | Тип | По умолчанию | Описание |
|---|---|---|---|
size | "sm" | "default" | "lg" | number | "default" | Управляет высотой поля ввода. Числовые значения передаются в нативный атрибут size |
unstyled | boolean | false | Если задано true, убирает стилизацию обёртки (рамку, тень и т. д.) |
Примеры
Для доступной разметки и валидации предпочтительно оборачивать поля ввода в компонент Field либо использовать компонент FieldControl. См. связанные примеры.
Маленький размер
import { Input } from "@/components/ui/input";
export default function Particle() {
return (
<Input
aria-label="Введите текст"
placeholder="Введите текст"
size="sm"
type="text"
/>
);
}
Большой размер
import { Input } from "@/components/ui/input";
export default function Particle() {
return (
<Input
aria-label="Введите текст"
placeholder="Введите текст"
size="lg"
type="text"
/>
);
}
Отключённое состояние
import { Input } from "@/components/ui/input";
export default function Particle() {
return (
<Input
aria-label="Отключено"
disabled
placeholder="Отключено"
type="text"
/>
);
}
Файл
import { Input } from "@/components/ui/input";
export default function Particle() {
return <Input aria-label="Файл" type="file" />;
}
С меткой
import { useId } from "react";
import { Input } from "@/components/ui/input";
import { Label } from "@/components/ui/label";
export default function Particle() {
const id = useId();
return (
<div className="flex flex-col items-start gap-2">
<Label htmlFor={id}>Эл. почта</Label>
<Input
aria-label="Эл. почта"
id={id}
placeholder="you@example.com"
type="email"
/>
</div>
);
}
С кнопкой
import { Button } from "@/components/ui/button";
import { Group } from "@/components/ui/group";
import { Input } from "@/components/ui/input";
export default function Particle() {
return (
<Group aria-label="Подписка по email" className="gap-2">
<Input
aria-label="Email"
className="flex-1"
placeholder="you@example.com"
type="email"
/>
<div>
<Button variant="outline">Отправить</Button>
</div>
</Group>
);
}
Интеграция с формой
"use client";
import type { FormEvent } from "react";
import { useState } from "react";
import { Button } from "@/components/ui/button";
import { Field, FieldError, FieldLabel } from "@/components/ui/field";
import { Form } from "@/components/ui/form";
import { Input } from "@/components/ui/input";
export default function Particle() {
const [loading, setLoading] = useState(false);
const onSubmit = async (e: FormEvent<HTMLFormElement>) => {
e.preventDefault();
const formData = new FormData(e.currentTarget);
setLoading(true);
await new Promise((r) => setTimeout(r, 800));
setLoading(false);
alert(`Эл. почта: ${formData.get("email") || ""}`);
};
return (
<Form className="flex w-full max-w-64 flex-col gap-4" onSubmit={onSubmit}>
<Field name="email">
<FieldLabel>Эл. почта</FieldLabel>
<Input placeholder="you@example.com" required type="email" />
<FieldError>Введите корректный адрес эл. почты.</FieldError>
</Field>
<Button loading={loading} type="submit">
Отправить
</Button>
</Form>
);
}