MoreSheet
The places that do not fit in the phone's bottom bar, two by two in a sheet that comes up from the bottom.
import { MoreSheet, MobileNav } from '@sypnia/ui/react'
The sheet behind More
Press «More».
Code
import { useState } from 'react';
import { MobileNav, type NavItem, type RenderLink } from '@sypnia/ui/react';
// Five places with their names and «More» for the rest. Press More: the others open in a sheet, two by two.
const items: NavItem[] = [
{ href: '/tables', label: 'Tables', icon: 'table' }, { href: '/sql', label: 'SQL', icon: 'query' }, { href: '/users', label: 'Users', icon: 'users' },
{ href: '/keys', label: 'API keys', icon: 'key' }, { href: '/logs', label: 'Logs', icon: 'logs' }, { href: '/policies', label: 'Policies', icon: 'shield' },
{ href: '/settings', label: 'Settings', icon: 'settings' }, { href: '/account', label: 'Account', icon: 'user', foot: true },
];
export default function Bottom() {
const [current, setCurrent] = useState('/tables');
const link: RenderLink = ({ href, children, ...p }) => <a {...p} href={`#${href}`} onClick={(e) => { e.preventDefault(); setCurrent(href); p.onClick?.(); }}>{children}</a>;
return <MobileNav items={items} current={current} renderLink={link} />;
} When to use it
Use it when
- Behind «More» in MobileNav, which opens it for you.
Do not use it when
- Actions: it holds places, not commands.
For everyone
- It is a dialog named «More»; Escape closes it and the focus returns to «More».
Props
| MoreSheet | Type | Default |
|---|---|---|
itemsrequired | NavItem[] | |
onCloserequired | () => void | |
openrequired | boolean | |
current | string | |
renderLink | RenderLink | ({ children, ...p }) => <a {...p}>{children}</a> |
| MobileNav | Type | Default |
|---|---|---|
currentrequired | string | |
itemsrequired | NavItem[] | |
renderLink | RenderLink | ({ children, ...p }) => <a {...p}>{children}</a> |