Skip to main content

Typography

Bulma provides comprehensive typography helpers to control text size, alignment, transformation, weight, and font family. These utilities ensure consistent typography throughout your application.

Composable hook

These props are also available standalone via the useTypographyClasses hook — see Composable Mini-Hooks.

Reference

This page documents the bestax-bulma prop API for Bulma's typography helpers. For the underlying CSS utilities, see the official Bulma typography helpers.

tip

Most components in bestax-bulma take these typography properties through the useBulmaClasses hook, so check a component's props before passing one.

Size​

Control text size using the textSize prop. Bulma provides size levels with size 1 being the largest and size 7 being the smallest.

PropertyBulma ClassValue
textSize="1"is-size-13rem (48px)
textSize="2"is-size-22.5rem (40px)
textSize="3"is-size-32rem (32px)
textSize="4"is-size-41.5rem (24px)
textSize="5"is-size-51.25rem (20px)
textSize="6"is-size-61rem (16px)
textSize="7"is-size-70.75rem (12px)

Size Examples​

import { Content, Box } from '@allxsmith/bestax-bulma';

function SizeExamples() {
  return (
    <Box p="4">
      <Content textSize="1" mb="3">
        Size 1 - Largest (3rem)
      </Content>
      <Content textSize="2" mb="3">
        Size 2 - Very Large (2.5rem)
      </Content>
      <Content textSize="3" mb="3">
        Size 3 - Large (2rem)
      </Content>
      <Content textSize="4" mb="3">
        Size 4 - Medium Large (1.5rem)
      </Content>
      <Content textSize="5" mb="3">
        Size 5 - Medium (1.25rem)
      </Content>
      <Content textSize="6" mb="3">
        Size 6 - Normal (1rem)
      </Content>
      <Content textSize="7" mb="3">
        Size 7 - Small (0.75rem)
      </Content>
    </Box>
  );
}

Responsive Size​

You can apply responsive text sizes that change based on screen size using the viewport prop combined with textSize.

Responsive Breakpoints​

ViewportScreen SizeDescription
viewport="mobile"Up to 768pxMobile devices
viewport="tablet"769px and aboveTablet devices
viewport="desktop"1024px and aboveDesktop screens
viewport="widescreen"1216px and aboveWidescreen displays
viewport="fullhd"1408px and aboveFull HD and larger

Viewport-Specific Text Size Props​

For combining multiple viewports on a single element, use these per-viewport props instead of viewport + textSize. Each accepts values '1' through '7'.

PropertyBulma Class PatternTarget Viewport
textSizeMobileis-size-{n}-mobileUp to 768px
textSizeTabletis-size-{n}-tablet769px and above
textSizeDesktopis-size-{n}-desktop1024px and above
textSizeWidescreenis-size-{n}-widescreen1216px and above
textSizeFullhdis-size-{n}-fullhd1408px and above

Responsive Size Examples​

import { Title, Content, Box } from '@allxsmith/bestax-bulma';

function ResponsiveSizeExample() {
  return (
    <Box p="4">
      <Title textSizeMobile="2" textSizeDesktop="1" mb="4">
        Responsive Heading
      </Title>

      <Content textSizeMobile="5" textSizeTablet="4" textSizeDesktop="3">
        This text gets larger on bigger screens: size 5 on mobile, size 4 on
        tablet, and size 3 on desktop.
      </Content>
    </Box>
  );
}

Alignment​

Control text alignment using the textAlign prop.

PropertyBulma ClassValue
textAlign="left"has-text-leftLeft aligned
textAlign="centered"has-text-centeredCenter aligned
textAlign="right"has-text-rightRight aligned
textAlign="justified"has-text-justifiedJustified

Alignment Examples​

import { Content, Box } from '@allxsmith/bestax-bulma';

function AlignmentExamples() {
  return (
    <Box p="4">
      <Content textAlign="left" mb="3" bgColor="light" textColor="dark" p="3">
        Left aligned text - This text is aligned to the left side of the
        container.
      </Content>

      <Content
        textAlign="centered"
        mb="3"
        bgColor="light"
        textColor="dark"
        p="3"
      >
        Centered text - This text is centered within the container.
      </Content>

      <Content textAlign="right" mb="3" bgColor="light" textColor="dark" p="3">
        Right aligned text - This text is aligned to the right side of the
        container.
      </Content>

      <Content textAlign="justified" bgColor="light" textColor="dark" p="3">
        Justified text - This longer text is justified, which means it spreads
        out to fill the entire width of the container, creating straight edges
        on both sides by adjusting the spacing between words.
      </Content>
    </Box>
  );
}

Responsive Alignment​

Apply responsive text alignment that changes based on screen size.

Viewport-Specific Text Align Props​

Like the text size viewport props, these per-viewport alignment props can be combined on one element. Each accepts 'centered', 'justified', 'left', or 'right'.

PropertyBulma Class PatternTarget Viewport
textAlignMobilehas-text-{value}-mobileUp to 768px
textAlignTablethas-text-{value}-tablet769px and above
textAlignDesktophas-text-{value}-desktop1024px and above
textAlignWidescreenhas-text-{value}-widescreen1216px and above
textAlignFullhdhas-text-{value}-fullhd1408px and above

Each one but textAlignMobile applies from its breakpoint up, so a larger breakpoint's alignment overlaps a smaller one's. Where they overlap, Bulma's stylesheet picks the result, not the larger breakpoint: the later of centered, justified, left and right wins, so textAlignTablet="right" stays right on a desktop with textAlignDesktop="left". A text size from a larger breakpoint does take over.

Responsive Alignment Examples​

import { Title, Content, Box } from '@allxsmith/bestax-bulma';

function ResponsiveAlignmentExample() {
  return (
    <Box p="4">
      <Title textAlignMobile="centered" textAlignDesktop="left" mb="4">
        Responsive Alignment
      </Title>

      <Content
        textAlignMobile="centered"
        textAlignTablet="justified"
        textAlignDesktop="left"
      >
        This text is centered on mobile, justified on tablet, and left-aligned
        on desktop screens. Resize your browser to see the changes.
      </Content>
    </Box>
  );
}

Text Transformation​

Control text transformation using the textTransform prop.

PropertyBulma ClassValue
textTransform="capitalized"is-capitalizedCapitalize first letter of each word
textTransform="lowercase"is-lowercaseAll lowercase
textTransform="uppercase"is-uppercaseALL UPPERCASE
textTransform="italic"is-italicItalic text
textTransform="underlined"is-underlinedUnderlined text

A link inside a sentence takes textTransform="underlined": outside a Notification or Message, Bulma draws links without an underline, so in a sentence a link would differ from the words around it by color alone (WCAG 1.4.1).

Text Transformation Examples​

import { Content, Box } from '@allxsmith/bestax-bulma';

function TextTransformExamples() {
  return (
    <Box p="4">
      <Content textTransform="capitalized" mb="3">
        capitalized text - Each Word Is Capitalized
      </Content>

      <Content textTransform="lowercase" mb="3">
        LOWERCASE TEXT - all letters become lowercase
      </Content>

      <Content textTransform="uppercase" mb="3">
        uppercase text - ALL LETTERS BECOME UPPERCASE
      </Content>

      <Content textTransform="italic" mb="3">
        Italic text - This text appears in italics
      </Content>

      <Content textTransform="underlined">
        Underlined text - This text is underlined
      </Content>
    </Box>
  );
}

Text Weight​

Control font weight using the textWeight prop.

PropertyBulma ClassValue
textWeight="light"has-text-weight-light300 weight
textWeight="normal"has-text-weight-normal400 weight (default)
textWeight="medium"has-text-weight-medium500 weight
textWeight="semibold"has-text-weight-semibold600 weight
textWeight="bold"has-text-weight-bold700 weight

Text Weight Examples​

import { Content, Box } from '@allxsmith/bestax-bulma';

function TextWeightExamples() {
  return (
    <Box p="4">
      <Content textWeight="light" textSize="4" mb="3">
        Light weight text (300)
      </Content>

      <Content textWeight="normal" textSize="4" mb="3">
        Normal weight text (400)
      </Content>

      <Content textWeight="medium" textSize="4" mb="3">
        Medium weight text (500)
      </Content>

      <Content textWeight="semibold" textSize="4" mb="3">
        Semibold weight text (600)
      </Content>

      <Content textWeight="bold" textSize="4">
        Bold weight text (700)
      </Content>
    </Box>
  );
}

Font Family​

Control font family using the fontFamily prop.

PropertyBulma ClassValue
fontFamily="sans-serif"is-family-sans-serifSans-serif font stack
fontFamily="monospace"is-family-monospaceMonospace font stack
fontFamily="primary"is-family-primaryPrimary font family
fontFamily="secondary"is-family-secondarySecondary font family
fontFamily="code"is-family-codeCode font family (usually monospace)

Font Family Examples​

import { Content, Box } from '@allxsmith/bestax-bulma';

function FontFamilyExamples() {
  return (
    <Box p="4">
      <Content fontFamily="sans-serif" mb="3">
        Sans-serif font family - Clean, modern appearance without serifs
      </Content>

      <Content fontFamily="monospace" mb="3">
        Monospace font family - Each character takes the same width
      </Content>

      <Content fontFamily="primary" mb="3">
        Primary font family - The primary font defined in your theme
      </Content>

      <Content fontFamily="secondary" mb="3">
        Secondary font family - The secondary font defined in your theme
      </Content>

      <Content fontFamily="code">
        Code font family - Optimized for displaying code snippets
      </Content>
    </Box>
  );
}

Combined Typography​

Create sophisticated typography by combining multiple typography properties:

import { Title, SubTitle, Content, Box, Card } from '@allxsmith/bestax-bulma';

function CombinedTypographyExample() {
  return (
    <Box p="4">
      <Card p="6">
        <Card.Content>
          <Title
            textSize="1"
            textAlign="centered"
            textWeight="bold"
            textColor="primary"
            mb="3"
          >
            Main Heading
          </Title>

          <SubTitle
            textSize="4"
            textAlign="centered"
            textWeight="light"
            textColor="grey"
            textTransform="uppercase"
            mb="5"
          >
            Article Subtitle
          </SubTitle>

          <Content
            textSize="5"
            textAlign="justified"
            textWeight="normal"
            fontFamily="primary"
            mb="4"
          >
            This is the main content paragraph with justified alignment and
            normal weight. It demonstrates how multiple typography properties
            can be combined to create sophisticated text layouts.
          </Content>

          <Content
            textSize="6"
            textAlign="right"
            textWeight="medium"
            textTransform="italic"
            textColor="grey-dark"
            fontFamily="secondary"
          >
            — Author Name, Publication Date
          </Content>
        </Card.Content>
      </Card>
    </Box>
  );
}

Article Layout Example​

Here's a comprehensive example showing typography in an article layout:

// import {
//   Title,
//   SubTitle,
//   Content,
//   Box,
//   Section,
//   Container,
// } from '@allxsmith/bestax-bulma';

function ArticleExample() {
  return (
    <Section py="6">
      <Container breakpoint="tablet" isMax>
        <Box>
          {/* Article Header */}
          <Title textSize="1" textWeight="bold" textAlign="centered" mb="3">
            The Future of Web Typography
          </Title>

          <SubTitle
            textSize="5"
            textWeight="normal"
            textAlign="centered"
            textColor="grey"
            mb="2"
          >
            Exploring modern approaches to web fonts and text layout
          </SubTitle>

          <Content
            textSize="7"
            textAlign="centered"
            textTransform="uppercase"
            textColor="grey-light"
            textWeight="medium"
            mb="6"
          >
            Published March 15, 2024
          </Content>

          {/* Article Body */}
          <Content textSize="5" textAlign="justified" mb="4">
            Typography is the art and technique of arranging type to make
            written language legible, readable, and appealing when displayed. In
            web development, good typography enhances user experience and
            communicates your brand's personality.
          </Content>

          <Content textSize="5" textAlign="justified" mb="4">
            With the evolution of CSS and web fonts, developers now have
            unprecedented control over typography. From variable fonts to
            advanced CSS features, the possibilities are endless.
          </Content>

          {/* Pull Quote */}
          <Box bgColor="light" p="4" my="5">
            <Content
              textSize="4"
              textWeight="medium"
              textAlign="centered"
              textTransform="italic"
              color="primary"
            >
              "Typography is the craft of endowing human language with a durable
              visual form."
            </Content>
          </Box>

          <Content textSize="5" textAlign="justified">
            As we continue to push the boundaries of web design, typography
            remains a fundamental pillar of effective communication and
            beautiful user interfaces.
          </Content>
        </Box>
      </Container>
    </Section>
  );
}

Learn More

For detailed API information about typography properties, see the useBulmaClasses API documentation.

See Also​