Skip to content
shadcn.io

shadcn.io is not affiliated with official shadcn/ui

Usage Ring AI Product Navbar Block for React

A one-bar navbar for a language-model API: five links, and a usage ring in the bar, one button that opens a popover with the tokens used, the limit, the reset and the plan, beside an Upgrade Shine Button.

Framework
UI library

Preview

Preview width

Installation

Part of Pro
Pro unlocks the code and one-line install of every Pro button and text effect, plus the MCP for your AI editor.
Have Pro already? Sign in to open it.Opens here as soon as you're Pro.

Overview

A navbar for an AI product in React with Base UI. The wordmark of Nimbalt, a language-model API, leads, and Models, Playground, API, Pricing and Research follow as plain links, the current page marked by a foreground stroke on the bar's bottom edge. At the end of the bar a small ring, filled to this month's share of the token limit, sits beside "1.24M / 2M": together they are one button, and pressing it opens a popover with what you've used (1.24M of 2M, 62%), when it resets (in 9 days) and your plan. The ring is drawn in the foreground tone, so the Upgrade Shine Button is the only primary control in the bar. Below the lg breakpoint the links fold into a sheet from the top and the ring stays in the bar, shrinking to its circle on a phone. The popover and the sheet open over the page, so the block stays one bar high. It's built from Circular Progress, Popover, Data List, Navigation Menu, Sheet, Shine Button and Guides. For API and model products whose users watch a quota.

FAQ

How do I show real usage?

Edit USAGE at the top of the file (used and limit in millions of tokens, resetsInDays, plan), or replace it with props from your server. The percentage (PERCENT), the ring, the trigger's label and the popover's rows all derive from it. The reset is typed as a count of days, not a date, so the block never reads the clock.

How is the ring named for a screen reader?

The ring is decoration inside a button; the button's own name says what it is and carries the figures: "Token usage this month: 1.24M / 2M". The visible text "1.24M / 2M" is part of that name, so voice control that says what it sees works. Inside the popover the figures are a definition list.

How does the popover work with a keyboard?

Enter or Space opens the popover and moves focus into it; Escape or a click outside closes it and puts focus back on the trigger. It isn't modal, so the rest of the bar stays reachable.

How does it work on a phone?

Below lg the links fold into a menu button that opens a sheet from the top, its header lined up with the bar (the wordmark where it was, the close button where the menu button was), with the links and an Upgrade button in its foot. The ring stays in the bar on every width; below sm its figures and the bar's Upgrade button give way to the circle and the sheet's. The popover fits the screen at 320 pixels.

How does it sit on the page?

It's the page's first block: its + marks and rails line up with every block under it, and it draws no bottom border because the next block's top rule is its bottom edge. The popover drops below the bar and never changes its height.

  • Pro

    A one-bar marketing navbar for a product roadmap tool: a wordmark, a Product menu of four areas with icons and one-line descriptions, plain links with the current page marked, Sign in and a Shine Button, and a sheet with the same links on phones.

  • Pro

    A one-bar navbar for an invoicing app in its free trial: four app links, a meter of fourteen day pips with the days to go that opens a popover of what ends, and an Upgrade Shine Button; the urgent state comes at three days.

  • Pro

    Upload Progress Chip Navbar

    Meters and progress

    A file storage navbar whose Upload button becomes a progress chip with Cancel, settles on Uploaded, and updates a storage meter.

  • Pro

    Usage Meters Billing

    Plan and usage

    Usage meters for an app's settings: one row per quota with its count, a bar that turns to a warning tone at 80% and an over-limit tone past 100%, and a plain line on what happens next.

  • Pro

    Spend controls as a selling point: a circular gauge of spend against a monthly cap set with a slider, email alerts at 50, 80 and 100% of the cap, and the choice of pausing jobs or keeping them running when the cap is reached.

  • Pro

    Account Menu Navbar

    Accounts and scopes

    An app bar with an account button behind a split divider that opens a menu: an identity header with plan badge and storage bar, a Switch account radio list, and Profile, Settings, Billing and Sign out.