grasscnGitHub

Label

Associated labels and wrapped Minecraft text.

Preview

Example source could not be loaded: label-example. Reload this page to retry.

Usage

Import Label from @/components/ui/label. Link htmlFor to the input's id. Activating the primary label focuses its associated input. scale accepts 1, 2 or 3 and defaults to 2.

Composition

String and number children use the native glyph renderer. For wrapping, set maxWidth in logical pixels and choose align="left" or align="center"; explicit newlines are supported. Use FieldLabel inside Field compositions for the same association with field layout.

API and accessibility

A disabled input does not automatically dim a static Label. Rich children render as supplied and are outside the native-text guarantee. Unicode atlas loading is asynchronous, and verified glyph coverage remains limited to declared reference cases.

See the underlying API for shared semantics.

Wrapped and centered

Example source could not be loaded: label-wrapped-example. Reload this page to retry.

Installation

Loading registry address

Component source

This is the component implementation. Its supporting styles, helpers and resources are also required. See complete manual installation.

Component implementationcomponents/ui/label.tsx · tsx
"use client";

import * as React from "react";

import { minecraftGlyphs } from "./minecraft-font";
import { labelUnihexAtlas } from "./minecraft-label-atlas";
import {
  isMinecraftTextContent,
  minecraftClasses as cn,
  minecraftStyle,
  MinecraftRender,
} from "./minecraft-render";

Interactive playground

WRAPPED / CENTEREDCreate a new world with friends
Click a label to focus its field