Reference · Where every tie sits
DrawOptionstype
Everything a drawing can be told: the layout, look, size, theme, background, language, marks, flags, trophy, links and titles.
Import it
import type { DrawOptions } from "@johnmorrisdotca/taisen-brackets/layout";
Also exported from: @johnmorrisdotca/taisen-brackets
Definition
interface DrawOptions extends LayoutOptions {
layout?: LayoutName;
headers?: boolean;
at?: boolean;
standings?: "points" | "record";
qualify?: number;
judo?: boolean;
style?: boolean;
styleScope?: string;
size?: SizeName | {
width: number;
height?: number | null;
};
orientation?: "auto" | "horizontal" | "vertical";
detail?: Detail;
theme?: ThemeName;
background?: boolean | BackgroundPresetName | BackgroundOptions | BackgroundImageOptions;
vs?: boolean;
codes?: boolean;
title?: string;
subtitle?: string;
roundNames?: readonly string[] | {
rounds: readonly {
name: string;
}[];
};
roundLabels?: boolean;
scores?: boolean;
seeds?: boolean;
markShape?: "round" | "square" | "none";
champion?: boolean;
trophy?: string;
emblems?: EmblemRenderer;
emblemStyle?: EmblemStyle;
emblemTint?: string;
flags?: FlagRenderer;
flagHref?: (code: string) => string | null | undefined;
tieClass?: (tie: Tie) => string | null | undefined;
look?: Look;
href?: (tie: Tie, side?: 0 | 1) => string | null | undefined;
highlightPath?: SideId;
thirdPlace?: "below" | "hide";
winnerHighlight?: boolean;
locale?: string | Locale;
words?: Partial<Words>;
teamName?: (team: Team, locale: Locale) => string | undefined;
id?: string;
className?: string;
}
Members
| Name | Type | Description |
|---|---|---|
layout (optional) | LayoutName | undefined |
|
headers (optional) | boolean | undefined | Big title tiles (the halves' groups: West and East, AFC and NFC) over each half, in any layout: each half's |
at (optional) | boolean | undefined | In the |
standings (optional) | "points" | "record" | undefined | In the |
qualify (optional) | number | undefined | In the |
judo (optional) | boolean | undefined | For |
style (optional) | boolean | undefined | Write the |
styleScope (optional) | string | undefined | A class that carries this drawing's rules in place of its own: two drawings with the same |
size (optional) | SizeName | { width: number; height?: number | null; } | undefined |
|
orientation (optional) | "auto" | "horizontal" | "vertical" | undefined |
|
detail (optional) | Detail | undefined | |
theme (optional) | ThemeName | undefined |
|
background (optional) | boolean | "midnight" | "crimson" | "royal" | "emerald" | "pitch" | "ice" | "hardwood" | "infield" | "turf" | "ball-panels" | "swirl" | "waves" | "glow" | "floodlights" | "confetti" | "carbon" | "aurora" | "sunburst" | "chevrons" | "halftone" | "argyle" | "contour" | "stardust" | "mesh" | "spotlight" | BackgroundOptions | BackgroundImageOptions | undefined | The background. |
vs (optional) | boolean | undefined | In the road look, write a small |
codes (optional) | boolean | undefined | In the road look, write each team's three-letter code under its mark in a box of marks alone. Default false for a bracket (a chart's |
title (optional) | string | undefined | |
subtitle (optional) | string | undefined | |
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… |
roundLabels (optional) | boolean | undefined | Show the round names over the columns. Default true; false in the flag-only look. |
scores (optional) | boolean | undefined | Show the scores. Default true. |
seeds (optional) | boolean | undefined | Show seeds: the number before the name in the classic look, and in the road look a small tag ( |
markShape (optional) | "round" | "none" | "square" | undefined |
|
champion (optional) | boolean | undefined | Show the champion in the centre once the final is played. Default true. |
trophy (optional) | string | undefined | A trophy for the centre, drawn above the champion: inline SVG, an image address, or (with |
emblems (optional) | EmblemRenderer | undefined | Draws the emblem a |
emblemStyle (optional) | EmblemStyle | undefined | The style an emblem is drawn in: |
emblemTint (optional) | string | undefined | A colour for the emblem's main part (a hex colour or |
flags (optional) | FlagRenderer | undefined | Draws the flag a team's |
flagHref (optional) | ((code: string) => string | null | undefined) | undefined | The address of the flag a team's |
tieClass (optional) | ((tie: Tie) => string | null | undefined) | undefined | A class for each tie's group, from the tie: |
look (optional) | Look | undefined |
|
href (optional) | ((tie: Tie, side?: 0 | 1) => string | null | undefined) | undefined | A link for each tie's box, from the tie and, for a link on one team's row, its side (0 or 1). Called with the tie alone first: an address
makes the whole box a link; when that gives none, each side is asked, and a row with an address is a link of its own. Each is a real
|
highlightPath (optional) | SideId | undefined | The id of a team whose path to the final is drawn as a dotted line in the look's highlight, the rest quieter. |
thirdPlace (optional) | "below" | "hide" | undefined | Where the third-place match goes: |
winnerHighlight (optional) | boolean | undefined | Highlight the side that went through. Default true. |
locale (optional) | string | Locale | undefined | The language: |
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: |
id (optional) | string | undefined | Prefix for the drawing's ids. Default: a hash of the bracket and the options. Only letters, digits, |
className (optional) | string | undefined | Extra class names for the root |
shape (optional) | "halves" | "ltr" | "auto" | undefined |
|
groupOrder (optional) | readonly string[] | undefined | The order of the halves' groups, first on the left: |
Examples
import { drawBracket, type DrawOptions } from "@johnmorrisdotca/taisen-brackets";
const options: DrawOptions = { look: "road", theme: "dark", size: "card", title: "Aurora Cup", locale: "ja" };
console.log(drawBracket([{ sides: ["Aurora", "Harbour"], score: [2, 1] }, { sides: ["Cascade", "Delta"], score: [0, 1] }, { sides: ["Aurora", "Delta"], score: [3, 1] }], options).startsWith("<svg"));trueWhat it prints (run when this page was built)