Skip to the content

Taisen Brackets対戦

Knockout brackets as SVG, from a list of ties.

Taisen (対戦, たいせん) is Japanese for a matchup: two sides facing each other. About the name

Contents

Reference · Draw a bracket, a table or a road to the final

TableOptionstype

What bracketTable can be told: the language and words, the round names, a caption and a class.

Import it

import type { TableOptions } from "@johnmorrisdotca/taisen-brackets";

Definition

interface TableOptions extends Pick<DrawOptions, "locale" | "words" | "teamName" | "roundNames"> {
    caption?: string;
    className?: string;
}

Members

NameTypeDescription
caption (optional)string | undefined

The table's caption. Default: the summary ("16 teams, 4 rounds").

className (optional)string | undefined

A class for the <table>. Default tb-table.

roundNames (optional)readonly string[] | { rounds: readonly { name: string; }[]; } | undefined

Names of the rounds, first round first (or just the last ones). Default: Final, Semi-finals, Quarter-finals, Round of 16…

locale (optional)string | Locale | undefined

The language: en (the default), fr, ja, es, de, or a Locale you made with defineLocale. Sets the words, the round names, the number and date formats and the lang of the drawing.

words (optional)Partial<Words> | undefined

Replace any of the language's words.

teamName (optional)((team: Team, locale: Locale) => string | undefined) | undefined

The name to draw for a team in this language: undefined keeps Team.names[locale] or Team.name. countryName(team.region, locale) makes a country's name from Intl, with no list of your own.

Examples

import { bracketTable, type TableOptions } from "@johnmorrisdotca/taisen-brackets";

const options: TableOptions = { caption: "Aurora Cup", className: "results" };
console.log(bracketTable([{ sides: ["Aurora", "Harbour"], score: [2, 1] }, { sides: ["Cascade", "Delta"], score: [0, 1] }, { sides: ["Aurora", "Delta"], score: [3, 1] }], options).includes("Aurora Cup"));
true

What it prints (run when this page was built)

View sourceEdit on GitHubMade from the source of @johnmorrisdotca/taisen-brackets 0.20.0.