terra vidhal

Lineup Builder

Component

About

A football lineup builder with selectable formations, a visual pitch of position slots, a searchable bench, captain selection, auto-fill, an average rating readout, a live wage-cap bar and animated player placement.

Built with React and Tailwind. Copy the prompt and paste it into Claude Code, Cursor or Lovable: your agent adds Lineup Builder to your project and fits it to your theme.

Code

How Lineup Builder is used: the demo's code. The component's own source comes with a free account.

Usage.tsx

"use client";

/**
 * PrequelUI Animate — MIT — https://prequeluianimate.terravidhal.me
 */

import {
  LineupBuilder,
  type Formation,
  type LineupPlayer,
} from "@/components/ui/lineup-builder";

const PLAYERS: LineupPlayer[] = [
  { id: "milo", name: "Milo Tan", position: "GK", rating: 82, salary: 96000 },
  { id: "ravi", name: "Ravi Okonkwo", position: "GK", rating: 74, salary: 54000 },
  { id: "adrian", name: "Adrian Vale", position: "DEF", rating: 84, salary: 148000 },
  { id: "kofi", name: "Kofi Mensah", position: "DEF", rating: 80, salary: 121000 },
  { id: "luca", name: "Luca Bianchi", position: "DEF", rating: 79, salary: 112000 },
  { id: "noah", name: "Noah Keller", position: "DEF", rating: 77, salary: 98000 },
  { id: "emil", name: "Emil Sorensen", position: "DEF", rating: 75, salary: 86000 },
  { id: "tomas", name: "Tomas Reyes", position: "MID", rating: 86, salary: 186000 },
  { id: "kenji", name: "Kenji Mori", position: "MID", rating: 83, salary: 154000 },
  { id: "ibrahim", name: "Ibrahim Sow", position: "MID", rating: 81, salary: 132000 },
  { id: "felix", name: "Felix Marchetti", position: "MID", rating: 78, salary: 104000 },
  { id: "owen", name: "Owen Park", position: "FWD", rating: 87, salary: 205000 },
  { id: "diogo", name: "Diogo Alves", position: "FWD", rating: 84, salary: 168000 },
  { id: "samir", name: "Samir Haddad", position: "FWD", rating: 82, salary: 141000 },
];

const FORMATIONS: Formation[] = [
  {
    id: "433",
    label: "4-3-3",
    slots: [
      { id: "gk", role: "GK", label: "Goalkeeper", x: 50, y: 90 },
      { id: "lb", role: "DEF", label: "Left back", x: 15, y: 72 },
      { id: "cb1", role: "DEF", label: "Centre back", x: 38, y: 74 },
      { id: "cb2", role: "DEF", label: "Centre back", x: 62, y: 74 },
      { id: "rb", role: "DEF", label: "Right back", x: 85, y: 72 },
      { id: "cm1", role: "MID", label: "Centre mid", x: 30, y: 50 },
      { id: "cm2", role: "MID", label: "Holding mid", x: 50, y: 56 },
      { id: "cm3", role: "MID", label: "Centre mid", x: 70, y: 50 },
      { id: "lw", role: "FWD", label: "Left wing", x: 18, y: 24 },
      { id: "st", role: "FWD", label: "Striker", x: 50, y: 18 },
      { id: "rw", role: "FWD", label: "Right wing", x: 82, y: 24 },
    ],
  },
  {
    id: "442",
    label: "4-4-2",
    slots: [
      { id: "gk", role: "GK", label: "Goalkeeper", x: 50, y: 90 },
      { id: "lb", role: "DEF", label: "Left back", x: 15, y: 72 },
      { id: "cb1", role: "DEF", label: "Centre back", x: 38, y: 74 },
      { id: "cb2", role: "DEF", label: "Centre back", x: 62, y: 74 },
      { id: "rb", role: "DEF", label: "Right back", x: 85, y: 72 },
      { id: "lm", role: "MID", label: "Left mid", x: 15, y: 48 },
      { id: "cm1", role: "MID", label: "Centre mid", x: 38, y: 52 },
      { id: "cm2", role: "MID", label: "Centre mid", x: 62, y: 52 },
      { id: "rm", role: "MID", label: "Right mid", x: 85, y: 48 },
      { id: "st1", role: "FWD", label: "Striker", x: 38, y: 20 },
      { id: "st2", role: "FWD", label: "Striker", x: 62, y: 20 },
    ],
  },
  {
    id: "352",
    label: "3-5-2",
    slots: [
      { id: "gk", role: "GK", label: "Goalkeeper", x: 50, y: 90 },
      { id: "cb1", role: "DEF", label: "Centre back", x: 28, y: 74 },
      { id: "cb2", role: "DEF", label: "Sweeper", x: 50, y: 77 },
      { id: "cb3", role: "DEF", label: "Centre back", x: 72, y: 74 },
      { id: "lwb", role: "MID", label: "Left wing-back", x: 12, y: 50 },
      { id: "cm1", role: "MID", label: "Centre mid", x: 34, y: 54 },
      { id: "cm2", role: "MID", label: "Holding mid", x: 50, y: 57 },
      { id: "cm3", role: "MID", label: "Centre mid", x: 66, y: 54 },
      { id: "rwb", role: "MID", label: "Right wing-back", x: 88, y: 50 },
      { id: "st1", role: "FWD", label: "Striker", x: 38, y: 20 },
      { id: "st2", role: "FWD", label: "Striker", x: 62, y: 20 },
    ],
  },
];

export default function LineupBuilderDemo() {
  return (
    <main className="flex min-h-screen w-full items-center justify-center bg-gradient-to-b from-muted/40 via-background to-background px-4 py-8 sm:px-6">
      <LineupBuilder
        players={PLAYERS}
        formations={FORMATIONS}
        defaultFormation="433"
        salaryCap={1800000}
        title="Matchday squad · selection board"
        description="Build the eleven for the weekend. Balance the shape, the ratings and the weekly wage bill."
      />
    </main>
  );
}

Dependencies

More by terra vidhal

View all
  • Project Timeline

    Project Timeline

    30
  • Kanban Board

    Kanban Board

    20
  • Gravity Stars Background

    Gravity Stars Background

    20
  • Booking Calendar

    Booking Calendar

    18
  • Notification Center

    Notification Center

    16
  • Audio Waveform

    Audio Waveform

    16
  • Kpi Counter

    Kpi Counter

    16
  • Topographic Lines

    Topographic Lines

    16

Explore more

Part of PrequelUI Animate — browse the full library on 21st.dev.