Skip to content

UI

Every component in @haruhimemoe/ui, rendered from the package itself. haruhime.moe, packs, pools and bb are built from it. The source is on GitHub, and its README is at /libraries/ui. On a touch screen, buttons, chips, rows and fields are 44px tall.

Version 0.27.1, MIT license. Install: bun add @haruhimemoe/ui

Basics

Button

Primary, secondary and ghost, at md and lg, then disabled. On a touch screen they grow to 44px tall.

ButtonLink

A link that looks like a button. Paths use next/link; a URL with a scheme is a plain link, and so is a download (a plain link, never prefetched).

buttonClasses

The button classes as a string, for elements the components don't cover. Here, a summary.

More

It opens like any details element.

Card

The panel, without and with a title. A title makes it a region. Its heading is an h2 unless headingLevel says otherwise.

A card without a title. Just a rounded b4 panel.

A card with a title

The title names the card. It's an h4 here (headingLevel 4), under this demo's h3.

Badge

A small pill for a status or tag: neutral, accent, warning and muted.

rankednewcheck firstbeta

Notice

Short status text in each tone, then an error list as a div.

Info: the pack is saved in this browser.

Warning: two maps in this pool are loved, not ranked.

Error: that beatmap set doesn't exist.

Two maps couldn't be added:

  • 1234567 isn't a beatmap id.
  • 7654321 is already in the pack.

Disclosure

A button that shows and hides a panel, with aria-expanded. Closed, then open by default.

Ranked and loved maps only, no more than one map per mapper.

Tabs

An ARIA tab list for panels on the same page. Left and Right move and wrap, Home and End jump; only the chosen tab is in the Tab order.

The BBCode source, as you type it.

tabId

The id of a tab's button: tabId("ui-tabs", "write") is "ui-tabs-tab-write".

tabPanelId

The id of its panel: tabPanelId("ui-tabs", "write") is "ui-tabs-panel-write".

Text

Text

A line in one of six tones and three sizes. Error, warning and success get one step lighter when your system asks for more contrast.

default: the pool was saved an hour ago.

muted: the pool was saved an hour ago.

subtle: the pool was saved an hour ago.

error: the pool was saved an hour ago.

warning: the pool was saved an hour ago.

success: the pool was saved an hour ago.

xs, bold: That pack key is not valid.

textClasses

The same look as a string, for an element Text can't be: here, an output.

Saved.

PageHeader

The top of this page: the title in the page's one h1, a lead line with links, a meta line, and a CopyButton as the action.

TextLink

A text link. Accent (underlined pink) for running text; plain (bold, underlined on hover) for names in a list. Paths use next/link; a download is a plain link, never prefetched.

linkClasses

The link look as a string, for an element TextLink can't be: here, a button that reads as a link.

Prose

Long-form text. The disclaimers uses it with h2 headings.

A heading

A paragraph with bold text, inline code and a link to the thanks page.

  • A list item
  • Another one
  1. First
  2. Second
bun add @haruhimemoe/ui

SlotStars
NM15.21
DT16.05

Layout

Surface

Card's color and radius at a smaller padding: sm, md and lg.

  • Sample row, sm padding
  • Sample row, md padding
  • Sample row, lg padding

surfaceClasses

Surface's classes for an element Surface doesn't render, such as a next/link tile.

LinkCard

A card that is one link, with media, a link row and a code chip.

packs

Sample card: packs from a mappool.

bun add @haruhimemoe/ui

CardLink

The link that makes any relative box one click target.

CardGrid

A grid of cards as a list: one column on phones, more from sm.

  • Sample card A
  • Sample card B
  • Sample card C

StatList

A label/value stat list: inline, tiles and grid.

BPM
180
Stars
5.21
BPM
180
Stars
5.21
BPM
180
Stars
5.21
Length
2:08
Mode
osu!

EmptyState

Nothing here yet, dashed with a title, or filled and small.

No sample slots yet

Add one to get started.
Nothing matches these sample filters.

Progress

A labelled progress bar: with a status, and indeterminate.

Sample pack, 0 of 120 of 12 sets ready
Sample pack, 5 of 125 of 12 sets ready
Sample pack, workingBuilding the pack

LinkRow

A wrapping row of text links, the current one marked.

SectionHeading

The h2 under a page's h1: a detail count, an anchor and actions.

Sample pool (12)

#

PrevNext

Previous and next links at the end of a page in a series.

CodeChip

An inline code chip with a copy button.

bun add @haruhimemoe/ui

CopyField

A read-only field you copy from, like a pack key.

SegmentedControl

A two to four way view switch built on native radios: Tab lands on the checked one.

View
Preview size

Forms

TextInput

With a hint, then with a hint and an error, then with hideLabel, where the label is only for screen readers.

Shown on the pack page.

Textarea

With a hint, then with a hint and an error.

Anyone with the link can read these.
One per line.
abc isn't a beatmap id.

Select

With a hint, then with a hint and an error.

Which ruleset the pool is for.
How the list is ordered.
Pick an order.

Checkbox

With a hint, then with a hint and an error.

Check this box to go on.

RadioGroup

Native radios in a fieldset, on the Checkbox look: per-option hints, then a disabled option and a group error.

Who can see it
You can change this later.
Download as
Pick how to download the pack.

VisibilitySelect

Private, unlisted or public with who sees each: as radios with the default words, then as a select with its own words (the picked one's line is the hint).

Who can see this template
Only you and your editors.

VISIBILITIES

The three, most closed first: private, unlisted, public.

VISIBILITY_TEXT

The default words: Private, Unlisted, Public, each with its line.

CharCounter

How much of a limit a text uses. Type past 60 characters to see it turn rose and say how many to cut.

61 / 60 characters: 1 over the limit

ReportDisclosure

A report reason in a disclosure. The caller sends it and says how it went; here it waits a moment and thanks you.

fieldClasses

The field look as a string, for a bare control that labels itself.

Actions

CopyButton

Copies text and says so beside the button. The default, then a primary one with its own label and message.

InlineConfirm

A two-step confirm in the page. Opening it moves focus to the cancel button; cancel or Escape puts it back on the trigger.

Pretend deletes so far: 0

AsyncButton

Runs an async action and says how it went beside the button. The second one fails.

TypeToConfirm

For what can't be undone: the button stays off until the name is typed exactly.

Dialog

The modal base: follows an open prop, locks the page's scroll and hands focus back on close. Escape and a press outside ask the owner to close it.

ConfirmDialog

A confirm in a dialog, for a delete that affects other people or needs more than a sentence. The second asks for the name first.

Pagination

Links around the page count on the first, a middle and the last page. Then buttons for results fetched in place, where the page count isn't known.

Sortable

SortableList

One list on its own hook. Drag a row by its grip with a mouse or a finger, or focus the grip and use Space and the arrow keys. The chevron buttons do the same in one press. Sample stages.

  1. Qualifiers
  2. Round of 16
  3. Quarterfinals
  4. Semifinals

useSortable

The hook behind it, for several lists at once. NM1 can't go to HD, and the board says why. Sample slots.

NM

  1. NM1
  2. NM2
  3. NM3

HD

  1. HD1
  2. HD2

SortableHandle

The grip in every row above: a button named “Reorder …”, 24px, 44px on touch screens, pressed while it is picked up.

SortableMoveButtons

Two chevron buttons beside each row (words with upText/downText): the same move, read out, with focus kept on the button you pressed (or the other one at an end).

SortableLayer

One per hook, out of sight: the live region that reads each pick-up, step and drop, and the instructions each grip points at.

moveItem

Applies a move to an array: the one line an onMove needs.

moveItem(["a", "b", "c"], 0, 2) gives ["b","c","a"]

SORTABLE_ITEM

The item classes for the hook used directly, keyed off data attributes: a line where the item will land, a dashed outline on a drop target, a grey one on the lifted item and on a refused target.

  • Lands above this one
  • Drop target
  • Picked up
  • Refused target

SORTABLE_CONTAINER

The list classes: an outline while an empty list, or an onto list's own space, is the target.

An empty list as the drop target

Filters

Chip

A toggle pill with aria-pressed: on, off after a click, disabled, and blocked with a reason (still focusable, the reason read as its description).

This search has no graveyard maps yet.

ChipGroup

Chips for picking several values. FL is blocked with a reason and EZ is disabled; the second group is disabled as a whole.

Mods
No FL star ratings from the mirror yet.

Picked: HD, DT

Game mode

ChoiceChips

Chips for picking one value, as native radios: arrow keys move and pick. Most played is disabled.

Order

Order: newest

RangeSlider

Two thumbs and a box at each end. Star rating is open-ended (10+ means no limit), length reads and writes m:ss, and BPM is disabled.

Star rating

Value: [0, null]

Length

Value in seconds: [60, 300]

BPM

FilterRow

One labelled row: the label on the left from sm up, above the controls on phones.

Game mode

FilterPanel

Filter rows under a title, with a live result count and Clear filters once a filter is set. On phones the rows fold behind the arrow button.

Sample pool

14 of 14 slots

Matching: NM1, NM2, NM3, NM4, HD1, HD2, HR1, HR2, DT1, DT2, DT3, FM1, FM2, TB

Tables

Table

The table in a wrapper that scrolls sideways on narrow screens, with a caption (shown here; it can be for screen readers only).

The sample pool's first slot of each mod
SlotModStarsLengthBPM
NM1NM5.21 stars2:08180
HD1HD5.35 stars2:22185
HR1HR5.80 stars2:13176
DT1DT6.05 stars1:28225
FM1FM5.60 stars2:26182

THead

The header row group of the table above.

TBody

Its body row group, with a line between rows.

Th

A column header (scope col by default), or a bold row header with scope row: the slots.

Td

A cell. Numeric ones (stars, length, BPM) use tabular numbers, so digits line up.

osu!

StarRating

A pill on osu!'s star-rating spectrum, from an easy map to a hard one. Screen readers hear the number and the unit (5.90 stars).

1.80 stars3.20 stars4.60 stars5.90 stars6.80 stars8.10 stars

BeatmapStats

CS, AR, OD, HP, BPM and length from plain numbers, as a description list. The second leaves out what it doesn't know.

Circle size
4
Approach rate
9.3
Overall difficulty
8.5
HP drain
5
Beats per minute
180
Length
2:08
Approach rate
10.3
Overall difficulty
10
Beats per minute
270
Length
1:28

ModBadge

A slot pill, colored by its mod bucket, then all 17 colors a custom bucket can take with color.

NMHDHRDTFMTBEZHTFL
skyamberrosevioletemeraldorangegreentealpinklimecyanfuchsiayellowredindigostoneneutral

PlayerCard

osu!-web's user card from a snapshot: cover, avatar, country and team flags, supporter heart, and the whole card links to the profile. It never fetches. The statuses here are sample data; leave status out for static data and the ring goes away.

  • Last seen 29 days agoOffline
  • Online
  • a role instead of a statusosu!
  • sample player
    no account given: name only

MapCard

One map from plain props, as a row or a card, over no background, its cover or a blurred cover. Sample data: a real osu! map, values rounded. Copy ID is on in the rows.

  • NM1

    [FOUR DIMENSIONS] mapped by Nakagawa-Kanon

    7.04 stars
    Circle size
    4
    Approach rate
    9
    Overall difficulty
    8
    HP drain
    6
    Beats per minute
    222
    Length
    4:23
  • NM1

    [FOUR DIMENSIONS] mapped by Nakagawa-Kanon

    7.04 stars
    Circle size
    4
    Approach rate
    9
    Overall difficulty
    8
    HP drain
    6
    Beats per minute
    222
    Length
    4:23
  • NM1

    [FOUR DIMENSIONS] mapped by Nakagawa-Kanon

    7.04 stars
    Circle size
    4
    Approach rate
    9
    Overall difficulty
    8
    HP drain
    6
    Beats per minute
    222
    Length
    4:23
Ranked

FREEDOM DiVE

xi

[FOUR DIMENSIONS] mapped by Nakagawa-Kanon

7.04 stars
Circle size
4
Approach rate
9
Overall difficulty
8
HP drain
6
Beats per minute
222
Length
4:23
Ranked

FREEDOM DiVE

xi

[FOUR DIMENSIONS] mapped by Nakagawa-Kanon

7.04 stars
Circle size
4
Approach rate
9
Overall difficulty
8
HP drain
6
Beats per minute
222
Length
4:23
Ranked

FREEDOM DiVE

xi

[FOUR DIMENSIONS] mapped by Nakagawa-Kanon

7.04 stars
Circle size
4
Approach rate
9
Overall difficulty
8
HP drain
6
Beats per minute
222
Length
4:23

MapSetCard

A set and its difficulties, each with Copy ID named by version. Sample data.

Mapped by Asphyxia

  • FOUR DIMENSIONS7.30 stars
    Approach rate
    9.3
    Beats per minute
    200

MapGroup

A bucket: heading with count of target, its maps and a dashed row per empty slot. Sample data.

NM (1 of 3) · Nomod

  1. NM1

    xi - FREEDOM DiVE

    · [FOUR DIMENSIONS] mapped by Nakagawa-Kanon
    7.04 stars
    Circle size
    4
    Approach rate
    9
    Overall difficulty
    8
    HP drain
    6
    Beats per minute
    222
    Length
    4:23
  2. Empty slot
  3. Empty slot

MapCover

A set's cover as a plain lazy image, sized from osu!'s file. With no set id it is a b5 placeholder.

FREEDOM DiVE cover (sample)

mapCoverUrl

The assets.ppy.sh cover URL for a set and size, or null for an id that isn't a positive whole number.

https://assets.ppy.sh/beatmaps/39804/covers/card.jpg

MAP_STATUS_LABELS

How osu!'s set statuses read on a card.

Ranked, Approved, Loved, Qualified, Pending, WIP, Graveyard

MapPreviewButton

Plays the set's preview clip from b.ppy.sh at half volume; one clip per page.

stopMapPreview

Stops whatever clip is playing, for route changes.

MapCopyScope

Inside one scope only the Copy ID pressed last says Copied. The MapCard rows above share one.

  • xi - FREEDOM DiVE

    · [FOUR DIMENSIONS] mapped by Nakagawa-Kanon
    7.04 stars
    Circle size
    4
    Approach rate
    9
    Overall difficulty
    8
    HP drain
    6
    Beats per minute
    222
    Length
    4:23

Brackets

BracketView

A @haruhimemoe/tourney Bracket as columns of match cards, one per round, scrolling sideways in its own box. Here SOS Brigade is highlighted and seed 8 is a bye.

Quarterfinals

  • M1Haruhi Fanclub0bye0
  • M2Literature Club5North High3
  • M3Computer Society5Kouyouen Academy4
  • M4SOS Brigade5Tsuruya Family1

Semifinals

  • M5Haruhi Fanclub5Literature Club2
  • M6Computer SocietySOS Brigade

Final

  • M7Haruhi FanclubWinner of M6

BracketMatchCard

One match: both sides, their scores and the winner in bold. The final's second side is still open, so it reads where it comes from.

M6Computer SocietySOS Brigade
M7Haruhi FanclubWinner of M6

bracketColumns

The layout BracketView draws from: one block per bracket side, one column per round, matches in bracket order.

  • winners, Quarterfinals: M1, M2, M3, M4
  • winners, Semifinals: M5, M6
  • winners, Final: M7

sideLabel

What an unknown side reads as, from where it comes from.

  • Seed 3
  • Winner of M5
  • Loser of M2

Icons

DiscordIcon

The Discord logo in the text color, kept white here (one of the colors Discord's brand guidelines allow), at the default size and larger. Screen readers skip it, so the link around it carries the name.

GitHubIcon

The GitHub mark in the text color, at the default size and larger. Screen readers skip it, so the link around it carries the name.

HaruhimeWordmark

The wordmark as inline SVG, in the brand's own colors, at the default size and larger. This site's header draws it too.

haruhime.moeharuhime.moe

HaruhimeWordmarkLink

The wordmark linking to haruhime.moe, dimmed until hovered. The tool sites put it in their footer.

ChevronUpIcon

One half of the pair SortableMoveButtons draws by default, aria-hidden since the button carries the name.

ChevronDownIcon

The other half of the pair, same size and treatment.

Shell

SiteHeader

The bar at the top of this page. The brand slot is the wordmark linking home, and the links are the tools, centered (navAlign center) in a nav named Tools. Tools that haven't launched show as text marked soon.

NavLinks

The link list inside SiteHeader. The current page's link gets aria-current and lights up: here, UI.

LinkTabs

A named nav of pill links, for switching views that are their own pages. The current one gets aria-current.

HeaderMenu

The header's account menu: a button that opens links. Escape, a click outside or leaving it closes the menu.

SiteFooter

The footer below: the Tools, haruhime.moe and Legal columns, the trademark line as fine print, and the Discord and GitHub icon links. The tool sites also show the haruhime.moe wordmark there, and pass tools={{ current }} for a haruhime tools column linking the other tools. This site turns both off: it is haruhime.moe, and its Tools column already lists every tool.

HARUHIME_TOOLS

The live tools as data: id, name, home page and a few words each. A tool joins the list when it goes live.

haruhimeToolsColumn

The footer column SiteFooter's tools prop adds, as plain data for a footer laid out by hand. Here from pools: pools is left out, and All tools links haruhime.moe.

PageShell

The frame around this page: a skip link (press Tab on a fresh load), the header, the main content and the footer, which stays at the bottom on short pages.

Content

ContentLayout

A section's frame: its nav beside the page, stacked on a phone. Live on /legal.

ContentNav

The section nav: the index link, then each group's pages, the current one marked. It frames /legal.

ContentPage

One content page: its h1, description, a Copy as Markdown button and the MDX body, plus optional authors, published and last-updated dates, reading time, a toc and a footer. Every /legal/<slug> page is one (a size-sm Prose, no toc or footer: legal text is short and stands alone). Its own h1 can't sit on this page, so there's no live example here.

searchContent

The filter ContentSearch runs: searchContent(items, "ppy") gives Disclaimers.

CopyMarkdownButton

Fetches a page's .md mirror and copies it, then says whether it worked.

BrandPage

A product's whole brand page from brandPageData, with slots for extra sections. Live on /brand.

BrandSwatch

One palette token: press it to copy the hex.

Palette

CommandPalette

Renders nothing until opened. This page doesn't mount its own: the site already has one, mounted once by AppPalette in SiteShell, so its Ctrl K (Cmd K) hotkey stays page-global instead of fighting a second instance here. Press Ctrl K (Cmd K), or use a button below, to open it.

CommandPaletteButton

A ghost button with a magnifier, your children as its label, and the hotkey hint. Opens the site's palette, the same one SiteHeader's actions slot uses.

openCommandPalette

Opens the mounted palette from anywhere, with no ref: a window event, so a plain button works.

siteCommands

The defaults in the site palette: Navigate ("Go to <page>" for every page in PAGES), Page (copy URL, back, top, reload, GitHub) and Help ("Report a bug" on haruhimemoe/haruhime.moe), plus AppPalette's own Libraries and Changelog groups. tools is false since haruhime.moe isn't one of HARUHIME_TOOLS.

evaluate

The palette's calculator, without eval: +-*/%^, unary minus, parentheses, k/m suffixes, pi, e, sqrt, abs, round, floor, ceil, min and max. Unparseable or non-finite is null.

Example
evaluate("1.5k * (2 + sqrt(9))")// 7500

formatResult

A calculator result as the palette shows it: up to 10 significant digits, trailing zeros dropped.

Example
formatResult(1 / 3)// "0.3333333333"

fuzzyScore

The palette's own ranking: a query matches when its letters appear in order, scored higher at a word start. A Provider can reuse it to rank its own rows the same way.

Example
fuzzyScore("cpu", "Copy page URL")// {"score":22,"ranges":[[0,1],[5,6],[10,11]]}fuzzyScore("go", "Sign out")// null

Articles

Toc

A sample table of contents, maxDepth 4: sticky beside the page from xl up, a disclosure above it on a phone. Labelled here to tell it apart from this page's own On this page nav.

Kbd

A keyboard key.

Press Ctrl+K to open the command palette.

kbdClasses

The class string Kbd renders, for a kbd you build yourself.

kbdClasses
rounded border border-b3 bg-b5 font-sans text-c3 contrast-more:border-c4 px-1.5 text-xs

A hand-built key: Esc

Figure

An MDX-authored figure: a sized image with a caption and credit line.

The Evergreen Cup skyline banner
Sample captionSample credit

Steps

A numbered-rail wrapper around a plain ordered list.

  1. Register a team.
  2. Submit your pool picks.
  3. Show up for your match.

Embed

A click-to-load video: nothing loads from YouTube or Twitch until the reader presses play.

MdxLinkCard

An MDX-authored link card: a title, a description and a source line.

haruhimemoe/ui, opens in a new tab

The React kit this page is built from.

github.com

Schedule

An ordered list of dated rows.

  1. Week 1

    Signups open

    Sample row

  2. Pools lock

    Sample row

Glossary

A definition list whose entries a Term link can target by alias.

FM(Freemod)
Free mod: any one mod allowed.
NM
No mod: the base beatmap, no mods applied.

Term

A dotted-underline link from prose to a Glossary entry.

Most lobbies open with a freemod pick.

Utilities

cx

Joins classes, skips falsy ones, and lets a later Tailwind class win a conflict: the components use it to merge your className.

Example
cx("px-2 text-c3", false, "text-h1")// "px-2 text-h1"

useMotionAllowed

True when the visitor allows motion; false on the server and under reduced motion. The homepage's skyline video plays only when it says so. Change your system's reduce-motion setting and this line follows.

Your browser asks for reduced motion.

JsonLd

schema.org data in a script tag, so nothing shows. This page carries one describing the package; view the page source to see it.

Translation

LocaleSelect

A language picker for apps without locales in their URLs. One locale renders nothing.

localeName

A language named in itself: English, 日本語, 한국어, Português (Brasil).

writeLocaleCookie

Writes NEXT_LOCALE on a shared domain, what LocaleSelect does on a pick. Typeof: function.

PALETTE_LABELS

The command palette's English words, like "3 results".

SITE_COMMAND_LABELS

siteCommands' English titles, like "Go to Pools".

CONTENT_PAGE_LABELS

ContentPage's English meta words, like "4 min read".

BRAND_PAGE_LABELS

BrandPage's English headings: Name, Logo, Colors.