ข้ามไปยังเนื้อหา

เส้นทาง

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" },
  ]}
/>

props ทั้งหมด

ตัวอย่างด้านบนใช้ props เพียงบางตัว ตารางนี้แสดงทุกตัวที่คอมโพเนนต์รับ พร้อมค่าเริ่มต้นและค่าที่ใช้ได้

Breadcrumb props
ชื่อชนิดข้อมูลค่าเริ่มต้นคำอธิบาย
items* จำเป็นreadonly Crumb[]—The levels, from the top down. The last one is the current page.

ชนิดข้อมูล

Crumb

One level of a Breadcrumb.

Crumb fields
ชื่อชนิดข้อมูลค่าเริ่มต้นคำอธิบาย
label* จำเป็นstring—The level's name, already in the screen language.
hrefstring—Where it links. The last level, the current page, has none.

ข้อควรปฏิบัติ

  • อยู่ใน nav ที่ชื่อ เส้นทาง และหน้าปัจจุบันมี aria-current page

ซอร์สโค้ด: ui/src/marks.tsx