Text

Text is a fundamental component in every Design System. It is used to communicate information to the user and is a key part of the user interface. Text can be used in a variety of ways, such as headings, body text, buttons, links, and more.

terminal
code

Usage

import { BakaText } from "baka-ui";

function MyApp() {
  return (
    <BakaText>
      Hello, <em>Baka</em> UI!
    </BakaText>
  );
}

Variants

Text can be styled in a variety of ways to convey different meanings or to create visual hierarchy. The following variants are available and are grouped into five categories: display, headline, title, label, and body.

VariantSpecification
display-largeRoboto 57/64 -0.25
display-mediumRoboto 45/52 . 0
display-smallRoboto 36/44 . 0
headline-largeRoboto 32/40 . 0
headline-mediumRoboto 28/368 . 0
headline-smallRoboto 24/32 . 0
title-largeRoboto Regular 22/28 . 0
title-mediumRoboto Medium 16/24 . +0.15
title-smallRoboto Medium 14/20 . +0.1
label-largeRoboto Medium 14/20 . +0.1
label-mediumRoboto Medium 12/16 . +0.5
label-smallRoboto Medium 11/16 . +0.5
body-largeRoboto Regular 16/24 . +0.5
body-mediumRoboto Regular 14/20 . +0.25
body-smallRoboto Regular 12/16 . +0.4

Color Variations

In addition to the typography variants, the Text component also provides color variants through the variant property. Setting variant={"variant"} will apply the respective on-variant color to the text.

import { BakaText } from "baka-ui";

function MyApp() {
  return <BakaText variant="variant">subtext</BakaText>;
}

Polymorphic Rendering

The Text component is designed to work with any DOM element and allows for polymorphic rendering. The Text component can also be composed from multiple components like the next/link's Link component, according to the application requirements.

import { BakaText } from "baka-ui";

function MyApp() {
  return (
    <>
        <BakaText as="h1">
        Hello, <em>Baka</em> UI!
        </BakaText>
        <BakaText as="a" href="www.baka-ui.com">
        Learn more
        </BakaText>
    <>
  );
}