Single Elemination Tournament Bracket In Vue

Description:

A simple plan Vue.js library to render a single-elimination tournament bracket on the app.

Basic usage:

1. Install and import the tournament bracket component.

import Bracket from "vue-tournament-bracket";

2. Insert a tournament bracket component into the template.

<template>
  <bracket :rounds="rounds">
    <template slot="player" slot-scope="{{ player }}">
      {{ player.name }}
    </template>
  </bracket>
<template>

3. Create your own rounds as follows:

const rounds = [
      //Semi finals
      {
          games: [
              {
                  player1: { id: "1", name: "Competitor 1", winner: false },
                  player2: { id: "4", name: "Competitor 4", winner: true },
              },
              {
                  player1: { id: "5", name: "Competitor 5", winner: false },
                  player2: { id: "8", name: "Competitor 8", winner: true },
              }
          ]
      },
      //Final
      {
          games: [
              {
                  player1: { id: "4", name: "Competitor 4", winner: false },
                  player2: { id: "8", name: "Competitor 8", winner: true },
              }
          ]
      }
];

4. Register and enable the tournament bracket.

export default {
  components: {
    Bracket
  },
  data() {
    return {
      rounds: rounds
    }
  }
}

Preview:

Single Elemination Tournament Bracket In Vue

Download Details:

Author: kamilwylegala

Live Demo: https://codepen.io/sdudnyk/pen/bWbqMb

Download Link: https://github.com/kamilwylegala/vue-tournament-bracket/archive/master.zip

Official Website: https://github.com/kamilwylegala/vue-tournament-bracket

Install & Download:

# NPM
$ npm install vue-tournament-bracket --save

You Might Be Interested In:

Add Comment