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" />
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 size/style to fit your field size and be consistent with your application’s style:

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