Skip to content
portalbits
Home Docs GitHub(opens in a new tab)

Guides

Get startedFoundationsMotion

Components

All components

Buttons

ButtonIconButton

Inputs

InputSelectTextareaSlider

Selection

CheckboxToggleToggleGroupSwitchRadioGroup

Identity

AvatarBadge

Overlays

DialogPopoverTooltipDropdownMenuAlertDialog

Disclosure

TabsAccordion

Cards

AppCardArticleCardFeatureCard

Content

CarouselSectionHeaderEmptyStateAlertProgressSeparatorRowListRow

Chrome

PortalShellSidebarNavMobileNavTopBarAuthFrameColorSelectorFloatingNav

TopBar

A breadcrumb and a row of toolbar actions.

Components
Variations

Source

<script lang="ts">
  import 'portal-bits/styles.css';
  import 'portal-bits/tokens.css';
  import type { Snippet } from 'svelte';

  let { children }: { children: Snippet } = $props();
</script>

{@render children()}
<script lang="ts">
  import TopBarExample from './TopBarExample.svelte';
</script>

<TopBarExample breadcrumb={true} actions={true} />
<script lang="ts">
  import { Button, TopBar } from 'portal-bits';
  let { breadcrumb = true, actions = true }: { breadcrumb?: boolean; actions?: boolean } = $props();
</script>

{#snippet alerts()}
  <Button size={32}>
    <svg
      width="15"
      height="15"
      viewBox="0 0 24 24"
      fill="none"
      stroke="currentColor"
      stroke-width="2"
      stroke-linecap="round"
      stroke-linejoin="round"
      aria-hidden="true"
      ><path d="M10.268 21a2 2 0 0 0 3.464 0" /><path
        d="M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326"
      /></svg
    >
    Alerts
  </Button>
{/snippet}

<div class="bar">
  <TopBar
    breadcrumb={breadcrumb ? 'Components' : undefined}
    actions={actions ? alerts : undefined}
  />
</div>

<style>
  .bar {
    border: 1px solid var(--portal-border);
    border-radius: 16px;
    overflow: hidden;
    background: var(--portal-surface);
  }
</style>

API reference

These tables list the props and snippets that TopBar declares. Attributes passed through to an element or primitive are listed under Forwarded attributes, not here.

Props

NameTypeDefaultRequiredBindingDescription
breadcrumbstringNoneNoOne-wayThe current location. "Overview" shows when it is omitted.

Snippets

NameTypeDefaultRequiredBindingDescription
actionsSnippetNoneNoOne-wayYour controls, such as search or an account menu.

Forwarded attributes

None. TopBar forwards no attributes.

No data attributes are documented as stable.

Limits

  • TopBar owns no account or notification state. Supply those controls in `actions`.
  • The breadcrumb is one string, not a trail of links.

Related

  • PortalShell
  • FloatingNav
Previous MobileNav Next AuthFrame

On this page

  • Preview
  • Source
  • API reference
  • Props
  • Snippets
  • Forwarded attributes
  • Limits