เส้นทาง
Breadcrumb
Where the current page sits, from the top level down. The last item is the current page. On phones the levels between the first and the last fold into a … button that lists them. AppShell has its own breadcrumb in the top bar; use this one inside a page, such as above a record.
ใช้บอกตำแหน่งของหน้าภายในหน้า เช่น เหนือหน้ารายละเอียด รายการสุดท้ายคือหน้าปัจจุบันและไม่มีลิงก์ บนมือถือระดับกลางพับเป็นปุ่ม … AppShell มีเส้นทางของตัวเองในแถบด้านบนแล้ว
import { Breadcrumb } from "@bsru/ui";ตัวอย่าง
สี่ระดับ
ส่งแต่ละระดับจากบนลงล่าง ทุกระดับยกเว้นระดับสุดท้ายมี href ลองย่อหน้าจอให้แคบเพื่อดูปุ่ม …
<Breadcrumb
items={[
{ label: "หน้าหลัก", href: "#home" },
{ label: "งบประมาณและการเงิน", href: "#finance" },
{ label: "คำขอซื้อขอจ้าง", href: "#purchase-requests" },
{ label: "PR-2570-0001" },
]}
/>| Prop | ค่าในตัวอย่างนี้ | ชนิดข้อมูล | คำอธิบาย |
|---|---|---|---|
| items* จำเป็น | รายการ 4 รายการ[
{ label: "หน้าหลัก", href: "#home" },
{ label: "งบประมาณและการเงิน", href: "#finance" },
{ label: "คำขอซื้อขอจ้าง", href: "#purchase-requests" },
{ label: "PR-2570-0001" },
] | readonly Crumb[] | The levels, from the top down. The last one is the current page. |
props ทั้งหมด
ตัวอย่างด้านบนใช้ props เพียงบางตัว ตารางนี้แสดงทุกตัวที่คอมโพเนนต์รับ พร้อมค่าเริ่มต้นและค่าที่ใช้ได้
| ชื่อ | ชนิดข้อมูล | ค่าเริ่มต้น | คำอธิบาย |
|---|---|---|---|
| items* จำเป็น | readonly Crumb[] | — | The levels, from the top down. The last one is the current page. |
ชนิดข้อมูล
Crumb
One level of a Breadcrumb.
| ชื่อ | ชนิดข้อมูล | ค่าเริ่มต้น | คำอธิบาย |
|---|---|---|---|
| label* จำเป็น | string | — | The level's name, already in the screen language. |
| href | string | — | Where it links. The last level, the current page, has none. |
ข้อควรปฏิบัติ
- อยู่ใน nav ที่ชื่อ เส้นทาง และหน้าปัจจุบันมี aria-current page
ซอร์สโค้ด: ui/src/marks.tsx