面包屑允许用户跟踪并保持对他们在应用程序或网站中的位置的了解。 它们应该用于具有分层排列页面的大型网站和应用程序。
包含以下组件
面包屑
BreadcrumbsItem
BreadcrumbsSeparator
BreadcrumbsCollapsed
名称 | 类型 | 默认 | 描述 |
---|---|---|---|
组件 | 字符串 | 'div' | 组件的 HTML 元素 |
fontSizeIos | 字符串 | 'text-[17px]' | iOS 主题中的字体大小 |
fontSizeMaterial | 字符串 | 'text-[14px]' | Material 主题中的字体大小 |
名称 | 类型 | 默认 | 描述 |
---|---|---|---|
激活 | 布尔值 | 错误的 | 将面包屑项标记为活动/当前(通常是面包屑中的最后一项) |
颜色 | 对象 | 具有 Tailwind CSS 颜色类的对象 | |
colors.bgIos | 字符串 | '' | |
colors.bgMaterial | 字符串 | 'bg-md-light-secondary-container dark:bg-md-dark-secondary-container' | |
colors.textActiveIos | 字符串 | 'text-black dark:text-white' | |
colors.textActiveMaterial | 字符串 | 'text-md-light-on-secondary-container dark:text-md-dark-on-secondary-container' | |
colors.textIos | 字符串 | 'text-black text-opacity-55 dark:text-white dark:text-opacity-55' | |
colors.textMaterial | 字符串 | 'text-md-light-on-secondary-container dark:text-md-dark-on-secondary-container' | |
组件 | 字符串 | 'div' | 组件的 HTML 元素 |
名称 | 类型 | 默认 | 描述 |
---|---|---|---|
颜色 | 对象 | 具有 Tailwind CSS 颜色类的对象 | |
colors.bgIos | 字符串 | 'bg-black bg-opacity-15 dark:bg-white dark:bg-opacity-15' | |
colors.bgMaterial | 字符串 | 'bg-md-light-secondary-container dark:bg-md-dark-secondary-container' | |
colors.dotBgIos | 字符串 | 'bg-black dark:bg-white' | |
colors.dotBgMaterial | 字符串 | 'bg-md-light-primary dark:bg-md-dark-primary' | |
组件 | 字符串 | 'div' | 组件的 HTML 元素 |
import React, { useRef, useState } from 'react';import {Page,Navbar,NavbarBackLink,BlockTitle,BlockHeader,Block,Breadcrumbs,BreadcrumbsItem,BreadcrumbsSeparator,BreadcrumbsCollapsed,Popover,List,ListItem,Link,} from 'konsta/react';export default function BreadcrumbsPage() {const isPreview = document.location.href.includes('examplePreview');const popoverTargetRef = useRef(null);const [popoverOpened, setPopoverOpened] = useState(false);return (<Page><Navbartitle="Breadcrumbs"/><Block strong inset>Breadcrumbs allow users to keep track and maintain awareness of theirlocations within the app or website. They should be used for large sitesand apps with hierarchically arranged pages.</Block><BlockTitle>Basic</BlockTitle><Block strongIos outlineIos><Breadcrumbs><BreadcrumbsItem><Link>Home</Link></BreadcrumbsItem><BreadcrumbsSeparator /><BreadcrumbsItem><Link>Catalog</Link></BreadcrumbsItem><BreadcrumbsSeparator /><BreadcrumbsItem active>Phones</BreadcrumbsItem></Breadcrumbs></Block><BlockTitle>Scrollable</BlockTitle><BlockHeader>Breadcrumbs will be scrollable if they don't fit the screen</BlockHeader><Block strongIos outlineIos><Breadcrumbs><BreadcrumbsItem><Link>Home</Link></BreadcrumbsItem><BreadcrumbsSeparator /><BreadcrumbsItem><Link>Catalog</Link></BreadcrumbsItem><BreadcrumbsSeparator /><BreadcrumbsItem><Link>Phones</Link></BreadcrumbsItem><BreadcrumbsSeparator /><BreadcrumbsItem><Link>Apple</Link></BreadcrumbsItem><BreadcrumbsSeparator /><BreadcrumbsItem active>iPhone 12</BreadcrumbsItem></Breadcrumbs></Block><BlockTitle>Collapsed</BlockTitle><Block strongIos outlineIos><Breadcrumbs><BreadcrumbsItem><Link>Home</Link></BreadcrumbsItem><BreadcrumbsSeparator /><BreadcrumbsCollapsedref={popoverTargetRef}onClick={() => setPopoverOpened(true)}/><BreadcrumbsSeparator /><BreadcrumbsItem active>iPhone 12</BreadcrumbsItem></Breadcrumbs></Block><Popoveropened={popoverOpened}className="breadcrumbs-popover"style={{ width: '120px' }}target={popoverTargetRef.current}onBackdropClick={() => setPopoverOpened(false)}><List nested><ListItemlinktitle="Catalog"onClick={() => setPopoverOpened(false)}/><ListItemlinktitle="Phones"onClick={() => setPopoverOpened(false)}/><ListItemlinktitle="Apple"onClick={() => setPopoverOpened(false)}/></List></Popover></Page>);}