PeakUIPro

SettingsNew

A settings shell where every field shows its effect, and each view saves one way.

Open full screen

The Screen

Settings fail in two places: the reader cannot tell what a field will do, and the screen cannot decide whether it saves on change or on a button. This one answers both.

The store section puts the confirmation a customer receives beside the fields that write it. The name, the support address, the currency, the number format and the time zone all land in the receipt as they are typed, so the reader sees the result before committing it — and a form that shows its result can afford a save bar, which sticks to the bottom of the viewport while there is something to save and says so in words.

The notifications section saves the other way. A cell applies the moment it changes, the heading says so, and the line beside it names what was last applied. There is no save button and no toast: a setting that needs confirming is a form, and belongs in one. Team mixes the two on purpose — a role is one value with one effect, so it applies on change, while inviting a person and removing one are acts, and each gets a dialog that names who.

Four sections, four layouts: a form with a preview, rows of cells, a list of people, meters over a list of invoices. The section list is a column at md and a Select below it, because four tabs only fit 390 by shrinking their labels past reading.

Made Of

Source

Copy the folder into your project. The screen imports @peakui/react, @peakui-pro/react, @gravity-ui/icons and react, and nothing else. Replace data.ts with your own source: the receipt's subtotal, tax and total are added up there from the order's rows, the seat count is the length of the member list, and the order count is the figure the Analytics Dashboard template reports for the same store.

Two things are left for you to wire. The SAVE_DELAY timer in store-section.tsx stands where the request that writes the store belongs; put the request there and keep isPending on the button, so it cannot be pressed twice. And the buttons that end a destructive or outward-facing act — Delete store, Switch to Scale, Update card — close their dialog and do nothing else.

Nothing on this screen fetches, so nothing here shows a Skeleton. If your sections load their own data, draw one at the size of the block it replaces, inside that block's own sheet.

settings/template.tsx
"use client"; // the section, every draft and every cell on this screen are state

import type {SectionId} from "./data";

import {ArrowLeft} from "@gravity-ui/icons";
settings/data.ts
/*
 * The store behind the settings screen. Every string the screen shows is read from here, and the
 * confirmation preview is built from the same rows and rates an order would use, so a setting and
 * its preview can never disagree. `ordersUsed` below is the order count the Analytics Dashboard
 * template reports for the same store: one business, two screens. Replace this file with your own
settings/sheet.ts
/*
 * The two class lists every settings group on this screen shares.
 *
 * GROUP_SHEET is the only container shape here: a tone step on the ground, with no outline and
 * no shadow, because bg-surface already sits above bg-background in both themes.
settings/settings-nav.tsx
"use client"; // the chosen section is state, and the phone control is a Select

import type {SectionId} from "./data";
import type {ComponentType} from "react";
settings/store-section.tsx
"use client"; // the draft, the dirty state and the save are state

import type {CurrencyCode, StoreSettings} from "./data";
import type {FormEvent, ReactNode} from "react";
settings/order-receipt.tsx
import type {StoreSettings} from "./data";

import {SAMPLE_ORDER, money, orderDate, orderTotals} from "./data";

/*
settings/notifications-section.tsx
"use client"; // every cell here applies on change, so every cell is state

import type {ChannelId, NotificationSetting} from "./data";

import {Fieldset, ListBox} from "@peakui/react";
settings/team-section.tsx
"use client"; // the list, the filter and the two overlays are state

import type {Invite, Member, RoleId} from "./data";
import type {FormEvent} from "react";
settings/billing-section.tsx
"use client"; // the chosen plan is state until it is switched

import {ArrowUpRightFromSquare, CreditCard} from "@gravity-ui/icons";
import {Button, Chip, Description, Fieldset, Label, Link, Meter} from "@peakui/react";
import {NumberValue, RadioButtonGroup} from "@peakui-pro/react";

On this page