Skip to content
This repository was archived by the owner on Jun 24, 2025. It is now read-only.

Repository files navigation

mctext-react

This library allows you to display text with Minecraft formatting. It supports JSON (component-based) text as well as strings with formatting codes.
Obfuscated text is also supported and will behave as it does ingame.

Installation

npm i --save mctext-react

Usage

importMcTextfrom'mctext-react'<McText>§4red §lbold red §r§kobfuscated</McText><McText>{{text: '',extra: [{text: 'red ',color: 'dark_red'},{text: 'bold red ',bold: true,color: 'dark_red'},{text: 'obfuscated',obfuscated: true}]}}
</McText>

Properties

NameTypeDefaultDescription
children *string or objectThe text to display, see above.
colormapobjectsee belowAn alternate colormap used to map Minecraft colors to CSS colors.
randomCharsstringA…Za…z0…9!§$%&?#Characters to use for obfuscated text.
prefixstring§Character to use for color prefix, usually § or &.
styleobjectOverride the style of the text.

* required property

Colormap

The sixteen Minecraft colors are mapped to CSS colors by using a colormap. The default colormap uses the colors from the Minecraft Wiki.

Related projects

  • McTextBlock is a WPF component that displays Minecraft formatted text. It only supports strings with formatting codes.

License

The files included in this repository are licensed under the MIT license.

About

A React component to display Minecraft-formatted text.

Topics

Resources

Stars

5 stars

Watchers

2 watching

Forks

Releases

Packages

Used by

Contributors

Languages