Appearance
Button
Nút bấm cho hành động chính trong UI Soft Periwinkle. Dùng color cho tông trạng thái (mặc định primary) và variant cho kiểu hiển thị (solid, secondary, outline, ghost, link).
ts
import { Button } from "@minap/ui";1
Examples
Các mẫu theo use case thường gặp. Preview luôn sẵn; chọn View code khi cần xem hoặc copy mã nguồn.
Basic
Primary mặc định — điểm bắt đầu cho CTA chính.
tsx
import { Button } from "@minap/ui";
export function Example() {
return <Button>Continue</Button>;
}1
2
3
4
5
2
3
4
5
Variants
Toàn bộ variant mà Button hỗ trợ.
tsx
import { Button } from "@minap/ui";
export function Example() {
return (
<div className="flex flex-wrap gap-2">
<Button variant="solid">solid</Button>
<Button variant="secondary">secondary</Button>
<Button variant="outline">outline</Button>
<Button variant="ghost">ghost</Button>
<Button variant="link">link</Button>
</div>
);
}1
2
3
4
5
6
7
8
9
10
11
12
13
2
3
4
5
6
7
8
9
10
11
12
13
Colors
Các color (không truyền = primary) và ví dụ kết hợp với variant.
tsx
import { Button } from "@minap/ui";
export function Example() {
return (
<div className="flex flex-wrap gap-2">
<Button>primary</Button>
<Button color="success">success</Button>
<Button color="warning">warning</Button>
<Button color="destructive">destructive</Button>
<Button color="info">info</Button>
<Button color="destructive" variant="outline">
destructive outline
</Button>
</div>
);
}1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
Sizes
sm, default (chiều cao touch ~44px), lg, và icon.
tsx
import { Button } from "@minap/ui";
export function Example() {
return (
<div className="flex flex-wrap items-center gap-2">
<Button size="sm">sm</Button>
<Button size="default">default (~44px)</Button>
<Button size="lg">lg</Button>
<Button size="icon" aria-label="Star">
★
</Button>
</div>
);
}1
2
3
4
5
6
7
8
9
10
11
12
13
14
2
3
4
5
6
7
8
9
10
11
12
13
14
States
Disabled và trạng thái busy / loading — nhấn Controlled save trên Preview để xem.
tsx
import { useState } from "react";
import { Button } from "@minap/ui";
export function Example() {
const [pending, setPending] = useState(false);
return (
<div className="flex flex-wrap items-center gap-2">
<Button disabled>disabled</Button>
<Button
aria-busy={pending || undefined}
disabled={pending}
onClick={() => {
setPending(true);
window.setTimeout(() => setPending(false), 900);
}}
>
{pending ? "Saving…" : "Controlled save"}
</Button>
</div>
);
}1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
Composition
Kết hợp Button với Badge trong một cụm hành động / trạng thái.
tsx
import { Badge, Button } from "@minap/ui";
export function Example() {
return (
<div className="flex flex-wrap items-center gap-2">
<Button size="sm">Lưu</Button>
<Badge color="success">Sẵn sàng</Badge>
</div>
);
}1
2
3
4
5
6
7
8
9
10
2
3
4
5
6
7
8
9
10
Props / API
| Prop / API | Type | Default | Notes |
|---|---|---|---|
color | "primary" | "success" | "warning" | "destructive" | "info" | "primary" | Bỏ qua prop → primary. Không có color="default". |
variant | "solid" | "outline" | "ghost" | "link" | "secondary" | "solid" | Kiểu hiển thị (chrome) |
size | "default" | "sm" | "lg" | "icon" | "default" | default dùng chiều cao touch ~44px |
asChild | boolean | false | Radix Slot — render qua phần tử con |
pressFeedback | boolean | true | Press scale + overlay (--press-*). false cho field-like (DatePicker) / ô Calendar |
className | string | — | Tailwind / class bổ sung |
Behavior
- Focus ring rõ khi điều khiển bằng bàn phím hoặc tap
- Press feedback mặc định (token
--press-scale/--press-shadow); tắt bằngpressFeedback={false} - Tối ưu cảm ứng trên Mobile-First / WebView
- Chuyển tiếp các thuộc tính native của
<button>(ví dụtype,disabled,aria-*)