Template:Infobox elections
To use this template, paste the following code at the top of an election article and fill in the parameters that apply. Leave any parameter blank to omit that row from the infobox.
The template auto-switches its layout based on the type parameter. Use presidential for races with a single executive winner (showing nominee, running mate, home state, electoral vote, states carried). Use parliamentary or legislative for races where seats are contested (showing party leader, leader's seat, seats before/won/after, swing). Some rows only appear for one type, as noted below.
Blank template (full)
{{Infobox election
| election_name =
| country =
| flag_image =
| flag_year =
| type =
| ongoing =
| previous_election =
| previous_year =
| previous_mps =
| election_date =
| elected_mps =
| next_election =
| next_year =
| next_mps =
| registered =
| turnout =
| seats_for_election=
| party_name =
| party_colour =
<!-- Map -->
| map_image =
| map_size =
| map_alt =
| map_caption =
<!-- Party/candidate 1 -->
| party1 =
| colour1 =
| image1 =
| leader1 =
| nominee1 =
| running_mate1 =
| home_state1 =
| alliance1 =
| leader_since1 =
| leaders_seat1 =
| last_election1 =
| seats_before1 =
| seats1 =
| seats_after1 =
| seat_change1 =
| electoral_vote1 =
| states_carried1 =
| popular_vote1 =
| percentage1 =
| swing1 =
| seats_needed1 =
<!-- Party/candidate 2 -->
| party2 =
| colour2 =
| image2 =
| leader2 =
| nominee2 =
| running_mate2 =
| home_state2 =
| alliance2 =
| leader_since2 =
| leaders_seat2 =
| last_election2 =
| seats_before2 =
| seats2 =
| seats_after2 =
| seat_change2 =
| electoral_vote2 =
| states_carried2 =
| popular_vote2 =
| percentage2 =
| swing2 =
| seats_needed2 =
<!-- Party/candidate 3 -->
| party3 =
| colour3 =
| image3 =
| leader3 =
| nominee3 =
| running_mate3 =
| home_state3 =
| alliance3 =
| leader_since3 =
| leaders_seat3 =
| last_election3 =
| seats_before3 =
| seats3 =
| seats_after3 =
| seat_change3 =
| electoral_vote3 =
| states_carried3 =
| popular_vote3 =
| percentage3 =
| swing3 =
| seats_needed3 =
<!-- Add party/candidate blocks 4 through 9 in the same format if needed -->
<!-- Custom rows (up to 6 rows × 9 columns) -->
| 1blank =
| 1data1 =
| 1data2 =
| 1data3 =
| 2blank =
| 2data1 =
| 2data2 =
| 2data3 =
<!-- Opinion polls (only display when ongoing = yes; up to 5 polls) -->
| poll1_date =
| poll1_source =
| poll1_party1 =
| poll1_party2 =
| poll1_party3 =
| poll1_nominee1 =
| poll1_nominee2 =
| poll1_nominee3 =
<!-- Footer -->
| title =
| posttitle =
| before_election =
| before_party =
| after_election =
| after_party =
}}
Parameters
Basic election info
- election_name: Title shown at the top of the infobox. Defaults to the page name if blank.
- country: Country name, used to render a flag via
[[File:{{{1}}}|border|50px]]whenflag_imageis not set. - flag_image: Filename stem for a flag image (the template appends " flag.png" automatically). Renders at 200px above the election dates.
- flag_year: Year variant for the flag, passed through to
[[File:{{{1}}}|border|50px]]. - type: One of
parliamentary,legislative, orpresidential. Controls which rows appear. Capitalized variants also work. - ongoing: Set to
yesto suppress final results and show opinion poll rows instead. Leave blank or set tonofor a completed election. - election_date: Date or date range of the vote.
- registered: Number of registered voters.
- turnout: Turnout figure, usually a percentage with the change from the prior election.
- seats_for_election: Header text shown above the party columns for parliamentary or legislative elections (e.g., "All 250 seats in the National Assembly").
- previous_election: Article title of the previous election.
- previous_year: Year of the previous election, displayed as a left arrow link.
- previous_mps: Article title for the list of members elected in the previous election. Aliases:
previous_MPs,previous_members. - elected_mps: Article title for the list of members elected in this election (centered between the arrows).
- next_election: Article title of the next election.
- next_year: Year of the next election, displayed as a right arrow link.
- next_mps: Article title for the list of members elected in the next election. Aliases:
next_MPs,next_members.
Map
- map_image: Filename of a results map. Rendered below the main party columns.
- map_size: Size of the map, in
px(e.g.,400px). Defaults to 300px. - map_alt: Alt text for the map image.
- map_caption: Caption shown beneath the map.
- map: Alternative to
map_image. Accepts raw wikitext (useful for SVG maps with imagemap overlays).
Display options
- party_name: Set to
noto display party names as plain text without linking through theTemplate:[party]/meta/shortnamesystem. - party_colour (or party_color): Set to
noto disable automatic color bars fromTemplate:[party]/meta/color. Per-party colors set viacolour1,colour2, etc. still work. - alliance_name: Set to
noto display alliance names as plain text.
Per party or candidate (replace # with 1 through 9)
The template supports up to nine parties or candidates. Each block uses the same parameter names with a numeric suffix.
- party#: Party name. Used both as a label and to look up color/shortname meta-templates.
- colour# (or color#): Hex color (without the leading
#) for the bar under the party image. Overrides the meta-template lookup. - image#: Photograph or party logo, formatted as full image wikitext (e.g.,
File:Foo.jpg).
Parliamentary and legislative only:
- leader#: Name of the party leader.
- leader_since#: Date the leader took the role.
- leaders_seat#: Constituency the leader represents.
- last_election#: Vote share or seat count from the previous election.
- seats_before#: Seat count entering the election (after defections, by-elections, etc.).
- seats#: Seats won in this election. Hidden when
ongoing=yes. - seats_after#: Seat count after the election.
- seat_change#: Net change in seats.
- swing#: Percentage point swing.
- seats_needed#: Seats needed for a majority. Only renders when
ongoing=yes.
Presidential only:
- nominee# or candidate#: Candidate name. Use one or the other;
nominee#is preferred for party-nominated races. - running_mate#: Running mate's name.
- home_state#: Candidate's home state or region.
- electoral_vote#: Electoral votes received. Hidden when
ongoing=yes. - states_carried#: Number of states or regions carried. Hidden when
ongoing=yes.
Both types:
- alliance#: Coalition or electoral alliance name.
- popular_vote#: Total votes received.
- percentage#: Vote share.
Custom rows
Six free-form rows can be added with up to nine columns each. Replace the first digit (1-6) with the row number and the second (1-9) with the column number.
- #blank: Label for the row (e.g.,
1blank = Coalition). - #data#: Cell value for that row and party column (e.g.,
1data1 = Government,1data2 = Opposition).
Opinion polls
Polls only render when ongoing=yes. Up to five polls are supported. Replace the first digit (1-5) with the poll number and the second (1-9) with the candidate or party column.
- poll#_date: Date the poll was taken.
- poll#_source: Pollster name or citation.
- poll#_party#: Vote share for that party (parliamentary/legislative).
- poll#_nominee# or poll#_candidate#: Vote share for that candidate (presidential).
- title: Office being contested (e.g., "President", "Prime Minister"). Used in both the "before" and "after" labels.
- posttitle: Alternative wording for the elected-side label, replacing "Elected title".
- before_election: Name of the office holder going into the election.
- before_party: Their party affiliation.
- after_election: Name of the office holder after the election. If left blank when the election is over, the row shows "TBD".
- after_party: Their party affiliation.
Notes
- When using
ongoing=yes, results rows (seats won, electoral votes, states carried, popular vote, percentage, swing, seat change) are suppressed and replaced by an Opinion polls block. - Color bars under party images pull from
Template:[party name]/meta/colorif no explicitcolour#is set. If neither exists, the bar appears blank. - Party labels link through
Template:[party name]/meta/shortnameby default. Setparty_name=noto disable that lookup if the meta-templates don't exist.
| Editors can experiment in this template's sandbox (create) and testcases (create) pages. Subpages of this template. |