كل المكوّنات
Topbar
عرض شامل١٠ تصدير١ محور تنويع٢١ خاصيّة٤ ملف
import { Topbar, TopbarUser } from '@nili/ui';هذه صفحة العرض الشامل الخاصة بالمكتبة، معروضة حيّة. غيّر اللغة أو السمة من الأعلى وسَتتبعك.
الشريط
فتحة للشعار وصفّ من العناصر وفتحة إجراءات في النهاية. وlabel يسمّي المعلم — فصفحة فيها Topbar وSidebar تحوي معلمَي تنقّل، و«تنقّل، تنقّل» ليست قائمة معالم.
import { Topbar, TopbarItem, TopbarUser, Icon } from "@nili/ui"
import { RiHome5Line, RiFolderLine } from "@remixicon/react"
export function Example() {
return (
<Topbar
label="Main"
logo={<PlaceholderLogo company="apex-financial" size="sm" label="Apex Financial" />}
actions={
<TopbarUser
avatar={<Avatar size="xs" name="Ada Lovelace" tone="blue" />}
name="Ada Lovelace"
/>
}
>
<TopbarItem icon={<Icon icon={RiHome5Line} />} href="#">Home</TopbarItem>
<TopbarItem icon={<Icon icon={RiFolderLine} />} href="#" active>
Projects
</TopbarItem>
</Topbar>
)
}حالات العنصر
يعلّم active الصفحة الحالية. ويضيف menu الزاوية لعنصر يفتح قائمة منسدلة بدل التنقّل. ويجعله href رابطًا، وبدونه يُرسم زرًّا.
import { Topbar, TopbarItem } from "@nili/ui"
export function Example() {
return (
<Topbar label="Main">
<TopbarItem href="#" active>Projects</TopbarItem>
<TopbarItem href="#">Reports</TopbarItem>
<TopbarItem menu>Workspace</TopbarItem>
<TopbarItem disabled>Billing</TopbarItem>
</Topbar>
)
}فتحة الإجراءات
كل ما ينتمي إلى نهاية الشريط — البحث والإشعارات وإجراء رئيسي وقائمة الحساب. وهي فتحة حرّة لا قائمة ثابتة، للسبب نفسه الذي جعل كل فتحة خلفية أخرى في هذا النظام كذلك.
بحث · إشعارات · إجراء · حساب
3
import { Topbar, TopbarItem, TopbarUser, CompactButton, Button, Icon } from "@nili/ui"
import { RiSearchLine, RiNotification3Line } from "@remixicon/react"
export function Example() {
return (
<Topbar
label="Main"
actions={
<>
<CompactButton appearance="ghost" aria-label="Search">
<Icon icon={RiSearchLine} />
</CompactButton>
<CompactButton appearance="ghost" aria-label="Notifications">
<Icon icon={RiNotification3Line} />
</CompactButton>
<Button size="xs">New project</Button>
<TopbarUser
avatar={<Avatar size="xs" name="Ada Lovelace" tone="blue" />}
name="Ada Lovelace"
/>
</>
}
>
…
</Topbar>
)
}Topbar
extends ComponentPropsWithoutRef<'header'>
باقي الخصائص
| الخاصيّة | النوع | الافتراضي | ملاحظات |
|---|---|---|---|
| children | ReactNode | — | |
| aria-label | string | — | |
| label | string | — | Accessible name for the navigation landmark inside the bar. |
| logo | ReactNode | — | The brand mark on the leading edge. |
| actions | ReactNode | — | Controls pinned to the trailing edge — search, notifications, account. |
TopbarItem
extends Omit< ComponentPropsWithoutRef<'a'>, 'color' >
محاور التنويع — من تعريف cva للمكوّن
| الخاصيّة | النوع | الافتراضي | ملاحظات |
|---|---|---|---|
| active | boolean | false | The current page. |
باقي الخصائص
| الخاصيّة | النوع | الافتراضي | ملاحظات |
|---|---|---|---|
| children | ReactNode | — | |
| aria-label | string | — | |
| icon | ReactNode | — | |
| href | string | — | Makes it a link; without it the item renders as a `<button>`. |
| menu | boolean | false | Adds a chevron — the "Others ▾" item that opens a menu. |
| disabled | boolean | false |
TopbarUser
extends ComponentPropsWithoutRef<'button'>
باقي الخصائص
| الخاصيّة | النوع | الافتراضي | ملاحظات |
|---|---|---|---|
| children | ReactNode | — | |
| disabled | boolean | — | |
| required | boolean | — | |
| readOnly | boolean | — | |
| value | string | — | |
| defaultValue | string | — | |
| name* | string | — | |
| aria-label | string | — | |
| avatar | ReactNode | — |