Saltar al contenido principal

Scoreline

Every example on this page is live, drawn by the library's Storybook, where you can also change its props and see the result.

One match at a glance: the two sides either side of the score, or of the kick-off time before the match, with its status and date underneath. Use it for football or any sport with two sides.

The score always sits in the middle. Each side's name shows under its code when there is room for it, and is left out in a slim column, so you don't have to plan for that yourself.

Import​

import { Scoreline } from "~lib/data-display/scoreline";

Props​

NameTypeRequiredDefaultDescription
home{ code: string; name?: string }YesN/AThe side on the left
away{ code: string; name?: string }YesN/AThe side on the right
figurestringYesN/AThe score, such as "2 – 1", or the kick-off time
statusstringNoN/AA word for the badge under the score, such as "Full time"
livebooleanNofalseFill the badge, for a match being played
notestringNoN/AA line under the badge, such as the date
winner"home" | "away"NoN/ASet the other side's code in the normal weight
size"sm" | "md" | "lg" | "xl"No"md"From a slim column (sm) to the hero of a widget (xl)
align"center" | "inward"No"center"Center each side, or set it against the score
footer"stack" | "row"No"stack"Set the note under the badge, or beside it on one line

Examples​

Full Time​

Abrir Full Time en Storybook

Live​

Set live to fill the badge while the match is being played.

Abrir Live en Storybook

Before Kick-Off​

Pass the kick-off time as the figure.

Abrir Upcoming en Storybook

Slim Column​

When a name would not fit, the codes stand alone.

Abrir Slim Column en Storybook

Set Against the Score​

In a wide box, align="inward" keeps the codes next to the score so they read as one line.

Abrir Wide And Inward en Storybook

Status Beside the Note​

In a low box, footer="row" puts the badge and the note side by side on one line, which leaves room for the names above them.

Abrir Status Beside Note en Storybook

A note too long for the line is cut short with "…".

Abrir Status Beside Note Cut Short en Storybook

In a box too slim for the badge and the note's first word together, the note moves under the badge, as it does without footer="row".

Abrir Status Over Note In Slim Box en Storybook

Hero​

Abrir Hero en Storybook

See Also​

  • Avatar - Show a club's code in a circle with initials
  • Badge - Inline label
  • Display - A hero figure