Skip to content

Responsive design

The size prop controls pitch dimensions:

ValueWidthHeightUse Case
"small"600px350pxSmall widgets, sidebars
"normal"900px525pxDefault, standard views
"big"1200px700pxFull-page displays
"responsive"100%AutoFluid layouts (recommended)
"fill"100%100%Container-controlled sizing

Use size="responsive" for fluid layouts that adapt to container width:

<SoccerLineUp size="responsive" />

The pitch maintains a 12:7 aspect ratio and scales proportionally with its container.

Use fill for custom sizes and aspect ratios. The pitch will fill its container completely:

<div style={{ width: '100%', height: '400px' }}>
<SoccerLineUp size="fill" />
</div>

The pitch will stretch to fill both width and height of its parent container.

For consistent layouts, use fixed sizes:

<SoccerLineUp size="small" />
<SoccerLineUp size="normal" />
<SoccerLineUp size="big" />

Player markers scale automatically with the pitch (size: 'auto', the default). In small containers — typically with responsive or fill pitches — that can make the players too small to read. Set the team’s style.size to decouple the player size from the pitch size:

ValueDiameter
'auto'Scales with the pitch (default)
'small'24px
'medium'32px
'big'44px
numberCustom diameter in pixels
// Players keep a readable fixed size, no matter how small the pitch gets
<div style={{ width: '300px', height: '200px' }}>
<SoccerLineUp
size="fill"
homeTeam={{ squad, style: { size: 'small' } }}
/>
</div>

With explicit sizes, the number and name typography, the name label spacing and the marker border scale proportionally with the diameter. The size attribute can also be overridden per player — see the Styling guide.

1
2
4
5
3
6
8
10
9
11
7
function MatchView() {
return (
<div className="match-container">
<SoccerLineUp size="responsive" homeTeam={team} />
</div>
);
}
// Limit maximum width while staying responsive
<div style={{ maxWidth: '1000px', margin: '0 auto' }}>
<SoccerLineUp size="responsive" />
</div>
// Custom aspect ratio container
<div style={{ width: '100%', paddingBottom: '60%', position: 'relative' }}>
<div style={{ position: 'absolute', inset: 0 }}>
<SoccerLineUp size="fill" />
</div>
</div>

The component uses box-sizing: border-box internally. When using fill or responsive modes, ensure the parent container has defined dimensions:

<div className="soccer-lineup-wrapper">
<SoccerLineUp
size="responsive"
color={color}
pattern={pattern}
homeTeam={homeTeam}
awayTeam={awayTeam}
/>
</div>
.soccer-lineup-wrapper {
width: 100%;
/* For responsive mode, height is automatic */
/* For fill mode, specify height */
}
.soccer-lineup-wrapper {
width: 100%;
height: 500px; /* Required for fill mode */
}

Freely override the font family to be consistent with your application’s style. Overriding the font size is fine while using the default 'auto' player size:

.soccer-lineup-wrapper {
* {
font-family: 'Roboto';
font-size: 14px;
}
}

With explicit player sizes (style.size), prefer letting the library derive the typography: a global font-size override would cancel the proportional scaling.