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

MobileNav

The same destinations, arranged for a narrow viewport.

Mobile navigation is fixed to the bottom of the shell below 767px. The shell preview shows it when the viewport is narrow.

Open the shell

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 MobileNavExample from './MobileNavExample.svelte';
</script>

<MobileNavExample />
<script lang="ts">
  import { MobileNav, type NavItem } from 'portal-bits';
  // This example uses @lucide/svelte for the navigation icons. Omit `icon` to skip it.
  import { Component, Layers, LayoutGrid } from '@lucide/svelte';

  const items: NavItem[] = [
    { href: '#overview', label: 'Overview', icon: LayoutGrid },
    { href: '#foundations', label: 'Foundations', icon: Layers },
    { href: '#components', label: 'Components', icon: Component },
  ];
  // The consumer supplies the active URL. In SvelteKit, use the current pathname.
  const active = '#overview';
</script>

<!-- MobileNav is fixed to the bottom of the viewport below 767px. -->
<MobileNav {items} {active} />

API reference

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

Props

NameTypeDefaultRequiredBindingDescription
itemsNavItem[]NoneYesOne-wayNavigation items as `{ href, label, icon?, count? }`.
activestringNoneYesOne-wayThe `href` of the current item. It gets `aria-current="page"`.

Forwarded attributes

None. MobileNav forwards no attributes.

No data attributes are documented as stable.

Limits

  • The `nav` is always named "Mobile navigation".
  • `count` is not shown. Only the icon and label render.
  • The narrow breakpoint is an adaptation.

Related

  • SidebarNav
  • PortalShell
Previous SidebarNav Next TopBar

On this page

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