Template:Election box US auto/doc
| 40px | This is a documentation subpage for Template:Election box US auto. It contains usage information, categories and other content that is not part of the original template page. |
| This template uses Lua: |
Usage
Example: {{election box US auto|California|2016|United States Representative District 7}}
| Party | Candidate | Votes | % | |
|---|---|---|---|---|
| style="background-color: Template:Political party color; width: 5px;" | | Democratic | Ami Bera (Incumbent) | 152,133 | 51.2% |
| style="background-color: Template:Republican Party (US)/meta/color; width: 2px;" | | [[Republican Party (US)|Template:Republican Party (US)/meta/shortname]] | Scott R. Jones | 145,168 | 48.8% |
| Total votes | 297,301 | 100.0% | ||
| style="background-color: Template:Political party color" | | Democratic hold | |||
You can also include primary information in the same box. Example: {{election box US auto|California|2016|State Assembly Member District 65|primary=yes}}
| Primary election | ||||||
|---|---|---|---|---|---|---|
| Party | Candidate | Votes | % | |||
| style="background-color: Template:Political party color; width: 2px;" | | Democratic | Sharon Quirk-Silva | 42,890 | 54.3% | ||
| style="background-color:
|
[[California Republican Party|
|
Young Kim (Incumbent) | 36,028 | 45.7% | ||
| Total votes | 78,918 | 100.0% | ||||
| General election | ||||||
| style="background-color: Template:Political party color; width: 5px;" | | Democratic | Sharon Quirk-Silva | 79,654 | 53.2% | ||
| style="background-color:
|
[[California Republican Party|
|
Young Kim (Incumbent) | 69,941 | 46.8% | ||
| Total votes | 149,595 | 100.0% | ||||
| style="background-color: Template:Political party color" | | Democratic gain from [[California Republican Party|
| |||||
A {{election box}} template for US elections that automatically builds the table using tabular data from Commons.
| Parameter | Description | Type | Status | |
|---|---|---|---|---|
| State | 1 | no description
| String | required |
| Year | 2 | Year the election took place
| Number | required |
| Contest | 3 | Name of the contest as specified in the tabular data
| String | required |
| Type | type | Type of election, can be "Primary"
| String | optional |
| Hold | hold | "held" if the same party held the seat, or "flip" if Democrats/Republicans switched.
| Unknown | optional |
| Gain party | gain | Name of party which gains the seat
| String | optional |
| Loser party | loser | Name of party that lost the seat
| String | optional |
| Primary | primary | Whether to include primary information in the same template
| String | optional |