Skip to content
shadcn.io

shadcn.io is not affiliated with official shadcn/ui

Zoom Control Navbar Block for React

A design-tool navbar with a one-of-four tool group and a zoom cluster: minus, plus and a menu of Fit, 50%, 100% and 200% with their keys.

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 zoom-control navbar for React with Base UI, the bar of Sketchloom, a vector design tool. The wordmark leads, and the bar is cut into cells by solid dividers that meet the page's top rule with a plus. A tool group keeps exactly one tool on (Move, Frame, Pen or Text) and the keys V, F, P and T pick them. The zoom cluster steps through a list of stops (25, 50, 75, 100, 150, 200 and 300 percent) with a minus and a plus, and its percentage opens a menu of Zoom to fit, 50%, 100% and 200% with the keys 0, 5, 1 and 2; minus and plus go inert at the ends of the list, and each change is spoken in a polite line. Share, the Shine Button, closes the row. On a phone the tool group stays, the zoom shrinks to its percentage (which still opens the menu) and Share to its icon. The block stays 56 pixels high. It's built from Toggle Group, Dropdown Menu, Button, Kbd, Shine Button and Guides, with your theme's tokens for every colour. For editors and canvases whose header is the tool and the view.

FAQ

How do I change the zoom stops and the fit value?

Edit STOPS (percent, ascending), FIT and CHOICES at the top. Minus goes to the first stop below the current zoom and plus to the first above it, so a fit value that isn't a stop (82%) still steps sensibly. The menu marks the choice that matches the current zoom, and none when you've stepped to a stop it doesn't list.

Which keys work, and where?

V, F, P and T pick a tool; 0, 5, 1 and 2 pick a zoom from the menu's list; minus and plus step. They work anywhere on the page that isn't a text field, and never with Control, Command or Alt held. The key is part of each control's name, and the menu shows its hints. Remove the listener in the effect if your page needs those keys.

How does the tool group work with a keyboard?

One tool is always on. The arrow keys move between the tools and Space or Enter chooses the focused one. The zoom menu opens from its button with Enter, Space or the Down arrow, Escape closes it, and focus returns to the button.

Does the zoom change anything?

It changes the percentage the bar shows and speaks; there is no canvas here. Read zoom and tool from the bar's state in your own page and draw from them.

How does it fit on a phone?

The wordmark and Share shrink to their icons (the words stay for screen readers), the minus and plus hide below md, and the tool readout shows from lg. The percentage button opens the same menu, so every zoom is still one tap away. Nothing wraps and the bar is 56 pixels at every width.

What moves, and what happens with reduced motion?

Nothing moves on load. The menu fades and grows from its button, and instantly appears under reduced motion; a band of light sweeps across Share once on hover and focus (it fades in place under reduced motion).

  • Pro

    A builder navbar for a landing-page tool that switches the preview between desktop, tablet and mobile, shows the viewport size, and undoes those choices.

  • Pro

    An app navbar whose shortcuts work: G then H, P or S moves between pages, a question mark opens a dialog with every key in a table, and each link shows its keys on hover and keyboard focus.

  • Pro

    Icon-Only Navbar

    Cells and splits

    An icon-only navbar for a messaging app: six destinations in square cells on shared hairlines, each named by a tooltip, with unread dots and a Show labels toggle that widens the cells to reveal the words.

  • Pro

    File Tabs Navbar

    App toolbars

    An editor navbar for a browser IDE with closable file tabs, a dot on unsaved files, a branch chip with a changed count and a Run button that saves what changed.

  • Pro

    Presence Avatars Navbar

    Accounts and scopes

    A shared-document navbar with presence avatars and an editing count, and a Share popover holding the roster, a viewing switch and a link that copies.

  • Pro

    Create Menu Navbar

    App toolbars

    An app bar with a Shine Create button that opens a grouped menu with working key hints and a New from template submenu, and a bottom drawer with the same rows on phones.