--- url: "https://design-system.service.gov.uk/components/table/" titulek: "Table – GOV.UK Design System" h1: "Table" popis: "Use the table component to make information easier to compare and scan for users" jazyk: "en" kanonicka: "https://design-system.service.gov.uk/components/table/" drobecky: ["Home", "Components"] zdroj: "live" wayback_snapshot: "" stazeno: "2026-09-14 01:22:03" znaku: 31594 slov: 4714 kodovani: "windows-1250" sha256: "b1a52692f3a697cc295942d6b7b78076b3611d457e615b32929877bfb66266e1" --- # Table Use the table component to make information easier to compare and scan for users. - HTML - Nunjucks HTML ```
Dates and amounts
Date Amount
First 6 weeks ÂŁ109.80 per week
Next 33 weeks ÂŁ109.80 per week
Total estimated pay ÂŁ4,282.20
``` Nunjucks Nunjucks macro options Use options to customise the appearance, content and behaviour of a component when using a macro, for example, changing the text. Some options are required for the macro to work; these are marked as “Required” in the option description. Deprecated options are marked as “Deprecated”. If you’re using Nunjucks macros in production with “html” options, or ones ending with “html”, you must sanitise the HTML to protect against [cross-site scripting exploits](https://developer.mozilla.org/en-US/docs/Glossary/Cross-site_scripting). Primary options array **Required.** The rows within the table component. See macro options for rows. array Can be used to add a row of table header cells (``) at the top of the table component. See macro options for head. string Caption text. string Classes for caption text size. Classes should correspond to the available typography heading classes. boolean If set to `true`, the first cell in each row will be a table header (``). string Classes to add to the table container. object HTML attributes (for example data attributes) to add to the table container. Options for `rows` array objects string **Required.** If `html` is set, this is not required. Text for cells in table rows. If `html` is provided, the `text` option will be ignored. string **Required.** If `text` is set, this is not required. HTML for cells in table rows. If `html` is provided, the `text` option will be ignored. string Specify format of a cell. Currently we only use “numeric”. string Classes to add to the table row cell. integer Specify how many columns a cell extends. integer Specify how many rows a cell extends. object HTML attributes (for example data attributes) to add to the table cell. Options for `head` array objects string If `html` is set, this is not required. Text for table head cells. If `html` is provided, the `text` option will be ignored. string If `text` is set, this is not required. HTML for table head cells. If `html` is provided, the `text` option will be ignored. string Specify format of a cell. Currently we only use “numeric”. string Classes to add to the table head cell. integer Specify how many columns a cell extends. integer Specify how many rows a cell extends. object HTML attributes (for example data attributes) to add to the table cell. ``` {% from "govuk/components/table/macro.njk" import govukTable %} {{ govukTable({ caption: "Dates and amounts", captionClasses: "govuk-table__caption--m", firstCellIsHeader: true, head: [ { text: "Date" }, { text: "Amount" } ], rows: [ [ { text: "First 6 weeks" }, { text: "£109.80 per week" } ], [ { text: "Next 33 weeks" }, { text: "£109.80 per week" } ], [ { text: "Total estimated pay" }, { text: "£4,282.20" } ] ] }) }} ``` ## When to use this component Use the table component to let users compare information in rows and columns. ## When not to use this component Never use the table component to layout content on a page. Instead, use the [grid system](/styles/layout/#using-the-grid-system). ## How it works ### Table captions Use the `` element to describe a table in the same way you would use a heading. A caption helps users find, navigate and understand tables. There are other styling options for table captions. You can use `govuk-table__caption--s`, `govuk-table__caption--m`, `govuk-table__caption--l` and `govuk-table__caption--xl` classes to make them larger or smaller from the default. - HTML - Nunjucks HTML ```
Months and rates
Month you apply Rate for vehicles
January ÂŁ95
February ÂŁ55
March ÂŁ125
``` Nunjucks Nunjucks macro options Use options to customise the appearance, content and behaviour of a component when using a macro, for example, changing the text. Some options are required for the macro to work; these are marked as “Required” in the option description. Deprecated options are marked as “Deprecated”. If you’re using Nunjucks macros in production with “html” options, or ones ending with “html”, you must sanitise the HTML to protect against [cross-site scripting exploits](https://developer.mozilla.org/en-US/docs/Glossary/Cross-site_scripting). Primary options array **Required.** The rows within the table component. See macro options for rows. array Can be used to add a row of table header cells (``) at the top of the table component. See macro options for head. string Caption text. string Classes for caption text size. Classes should correspond to the available typography heading classes. boolean If set to `true`, the first cell in each row will be a table header (``). string Classes to add to the table container. object HTML attributes (for example data attributes) to add to the table container. Options for `rows` array objects string **Required.** If `html` is set, this is not required. Text for cells in table rows. If `html` is provided, the `text` option will be ignored. string **Required.** If `text` is set, this is not required. HTML for cells in table rows. If `html` is provided, the `text` option will be ignored. string Specify format of a cell. Currently we only use “numeric”. string Classes to add to the table row cell. integer Specify how many columns a cell extends. integer Specify how many rows a cell extends. object HTML attributes (for example data attributes) to add to the table cell. Options for `head` array objects string If `html` is set, this is not required. Text for table head cells. If `html` is provided, the `text` option will be ignored. string If `text` is set, this is not required. HTML for table head cells. If `html` is provided, the `text` option will be ignored. string Specify format of a cell. Currently we only use “numeric”. string Classes to add to the table head cell. integer Specify how many columns a cell extends. integer Specify how many rows a cell extends. object HTML attributes (for example data attributes) to add to the table cell. ``` {% from "govuk/components/table/macro.njk" import govukTable %} {{ govukTable({ caption: "Months and rates", captionClasses: "govuk-table__caption--l", firstCellIsHeader: true, head: [ { text: "Month you apply" }, { text: "Rate for vehicles" } ], rows: [ [ { text: "January" }, { text: "£95" } ], [ { text: "February" }, { text: "£55" } ], [ { text: "March" }, { text: "£125" } ] ] }) }} ``` ### Table headers Use table headers to tell users what the rows and columns represent. Use the `scope` attribute to help users of assistive technology distinguish between row and column headers. There are 2 ways to use the table component. You can use HTML or, if you are using [Nunjucks](https://mozilla.github.io/nunjucks/) or the [GOV.UK Prototype Kit](https://prototype-kit.service.gov.uk), you can use the Nunjucks macro. - HTML - Nunjucks HTML ```
Dates and amounts
Date Amount
First 6 weeks ÂŁ109.80 per week
Next 33 weeks ÂŁ109.80 per week
Total estimated pay ÂŁ4,282.20
``` Nunjucks Nunjucks macro options Use options to customise the appearance, content and behaviour of a component when using a macro, for example, changing the text. Some options are required for the macro to work; these are marked as “Required” in the option description. Deprecated options are marked as “Deprecated”. If you’re using Nunjucks macros in production with “html” options, or ones ending with “html”, you must sanitise the HTML to protect against [cross-site scripting exploits](https://developer.mozilla.org/en-US/docs/Glossary/Cross-site_scripting). Primary options array **Required.** The rows within the table component. See macro options for rows. array Can be used to add a row of table header cells (``) at the top of the table component. See macro options for head. string Caption text. string Classes for caption text size. Classes should correspond to the available typography heading classes. boolean If set to `true`, the first cell in each row will be a table header (``). string Classes to add to the table container. object HTML attributes (for example data attributes) to add to the table container. Options for `rows` array objects string **Required.** If `html` is set, this is not required. Text for cells in table rows. If `html` is provided, the `text` option will be ignored. string **Required.** If `text` is set, this is not required. HTML for cells in table rows. If `html` is provided, the `text` option will be ignored. string Specify format of a cell. Currently we only use “numeric”. string Classes to add to the table row cell. integer Specify how many columns a cell extends. integer Specify how many rows a cell extends. object HTML attributes (for example data attributes) to add to the table cell. Options for `head` array objects string If `html` is set, this is not required. Text for table head cells. If `html` is provided, the `text` option will be ignored. string If `text` is set, this is not required. HTML for table head cells. If `html` is provided, the `text` option will be ignored. string Specify format of a cell. Currently we only use “numeric”. string Classes to add to the table head cell. integer Specify how many columns a cell extends. integer Specify how many rows a cell extends. object HTML attributes (for example data attributes) to add to the table cell. ``` {% from "govuk/components/table/macro.njk" import govukTable %} {{ govukTable({ caption: "Dates and amounts", captionClasses: "govuk-table__caption--m", firstCellIsHeader: true, head: [ { text: "Date" }, { text: "Amount" } ], rows: [ [ { text: "First 6 weeks" }, { text: "£109.80 per week" } ], [ { text: "Next 33 weeks" }, { text: "£109.80 per week" } ], [ { text: "Total estimated pay" }, { text: "£4,282.20" } ] ] }) }} ``` ## Numbers in a table When comparing columns of numbers, align the numbers to the right in table cells. - HTML - Nunjucks HTML ```
Months and rates
Month you apply Rate for bicycles Rate for vehicles
January ÂŁ85 ÂŁ95
February ÂŁ75 ÂŁ55
March ÂŁ165 ÂŁ125
``` Nunjucks Nunjucks macro options Use options to customise the appearance, content and behaviour of a component when using a macro, for example, changing the text. Some options are required for the macro to work; these are marked as “Required” in the option description. Deprecated options are marked as “Deprecated”. If you’re using Nunjucks macros in production with “html” options, or ones ending with “html”, you must sanitise the HTML to protect against [cross-site scripting exploits](https://developer.mozilla.org/en-US/docs/Glossary/Cross-site_scripting). Primary options array **Required.** The rows within the table component. See macro options for rows. array Can be used to add a row of table header cells (``) at the top of the table component. See macro options for head. string Caption text. string Classes for caption text size. Classes should correspond to the available typography heading classes. boolean If set to `true`, the first cell in each row will be a table header (``). string Classes to add to the table container. object HTML attributes (for example data attributes) to add to the table container. Options for `rows` array objects string **Required.** If `html` is set, this is not required. Text for cells in table rows. If `html` is provided, the `text` option will be ignored. string **Required.** If `text` is set, this is not required. HTML for cells in table rows. If `html` is provided, the `text` option will be ignored. string Specify format of a cell. Currently we only use “numeric”. string Classes to add to the table row cell. integer Specify how many columns a cell extends. integer Specify how many rows a cell extends. object HTML attributes (for example data attributes) to add to the table cell. Options for `head` array objects string If `html` is set, this is not required. Text for table head cells. If `html` is provided, the `text` option will be ignored. string If `text` is set, this is not required. HTML for table head cells. If `html` is provided, the `text` option will be ignored. string Specify format of a cell. Currently we only use “numeric”. string Classes to add to the table head cell. integer Specify how many columns a cell extends. integer Specify how many rows a cell extends. object HTML attributes (for example data attributes) to add to the table cell. ``` {% from "govuk/components/table/macro.njk" import govukTable %} {{ govukTable({ caption: "Months and rates", captionClasses: "govuk-table__caption--m", firstCellIsHeader: true, head: [ { text: "Month you apply" }, { text: "Rate for bicycles", format: "numeric" }, { text: "Rate for vehicles", format: "numeric" } ], rows: [ [ { text: "January" }, { text: "£85", format: "numeric" }, { text: "£95", format: "numeric" } ], [ { text: "February" }, { text: "£75", format: "numeric" }, { text: "£55", format: "numeric" } ], [ { text: "March" }, { text: "£165", format: "numeric" }, { text: "£125", format: "numeric" } ] ] }) }} ``` ## Custom column widths You can use the [width override classes](/styles/layout/#width-override-classes) to set the width of table columns. - HTML - Nunjucks HTML ```
Month you apply
Date Rate for vehicles Rate for bicycles
First 6 weeks ÂŁ109.80 per week ÂŁ59.10 per week
Next 33 weeks ÂŁ159.80 per week ÂŁ89.10 per week
Total estimated pay ÂŁ4,282.20 ÂŁ2,182.20
``` Nunjucks Nunjucks macro options Use options to customise the appearance, content and behaviour of a component when using a macro, for example, changing the text. Some options are required for the macro to work; these are marked as “Required” in the option description. Deprecated options are marked as “Deprecated”. If you’re using Nunjucks macros in production with “html” options, or ones ending with “html”, you must sanitise the HTML to protect against [cross-site scripting exploits](https://developer.mozilla.org/en-US/docs/Glossary/Cross-site_scripting). Primary options array **Required.** The rows within the table component. See macro options for rows. array Can be used to add a row of table header cells (``) at the top of the table component. See macro options for head. string Caption text. string Classes for caption text size. Classes should correspond to the available typography heading classes. boolean If set to `true`, the first cell in each row will be a table header (``). string Classes to add to the table container. object HTML attributes (for example data attributes) to add to the table container. Options for `rows` array objects string **Required.** If `html` is set, this is not required. Text for cells in table rows. If `html` is provided, the `text` option will be ignored. string **Required.** If `text` is set, this is not required. HTML for cells in table rows. If `html` is provided, the `text` option will be ignored. string Specify format of a cell. Currently we only use “numeric”. string Classes to add to the table row cell. integer Specify how many columns a cell extends. integer Specify how many rows a cell extends. object HTML attributes (for example data attributes) to add to the table cell. Options for `head` array objects string If `html` is set, this is not required. Text for table head cells. If `html` is provided, the `text` option will be ignored. string If `text` is set, this is not required. HTML for table head cells. If `html` is provided, the `text` option will be ignored. string Specify format of a cell. Currently we only use “numeric”. string Classes to add to the table head cell. integer Specify how many columns a cell extends. integer Specify how many rows a cell extends. object HTML attributes (for example data attributes) to add to the table cell. ``` {% from "govuk/components/table/macro.njk" import govukTable %} {{ govukTable({ caption: "Month you apply", captionClasses: "govuk-table__caption--m", firstCellIsHeader: true, head: [ { text: "Date", classes: "govuk-!-width-one-half" }, { text: "Rate for vehicles", classes: "govuk-!-width-one-quarter" }, { text: "Rate for bicycles", classes: "govuk-!-width-one-quarter" } ], rows: [ [ { text: "First 6 weeks" }, { text: "£109.80 per week" }, { text: "£59.10 per week" } ], [ { text: "Next 33 weeks" }, { text: "£159.80 per week" }, { text: "£89.10 per week" } ], [ { text: "Total estimated pay" }, { text: "£4,282.20" }, { text: "£2,182.20" } ] ] }) }} ``` If the [width override classes](/styles/layout/#width-override-classes) do not meet your needs you can create your own width classes and apply them to the cells in the table head. These can be added using the `classes` option in the Nunjucks macro or adding the class directly to the individual cells within `govuk-table__head` as below. To learn more about this, read guidance on [extending and modifying components in production](/get-started/extending-and-modifying-components/). - HTML - Nunjucks HTML ```
Month you apply
Date Rate for vehicles Rate for bicycles
First 6 weeks ÂŁ109.80 per week ÂŁ59.10 per week
Next 33 weeks ÂŁ159.80 per week ÂŁ89.10 per week
Total estimated pay ÂŁ4,282.20 ÂŁ2,182.20
``` Nunjucks Nunjucks macro options Use options to customise the appearance, content and behaviour of a component when using a macro, for example, changing the text. Some options are required for the macro to work; these are marked as “Required” in the option description. Deprecated options are marked as “Deprecated”. If you’re using Nunjucks macros in production with “html” options, or ones ending with “html”, you must sanitise the HTML to protect against [cross-site scripting exploits](https://developer.mozilla.org/en-US/docs/Glossary/Cross-site_scripting). Primary options array **Required.** The rows within the table component. See macro options for rows. array Can be used to add a row of table header cells (``) at the top of the table component. See macro options for head. string Caption text. string Classes for caption text size. Classes should correspond to the available typography heading classes. boolean If set to `true`, the first cell in each row will be a table header (``). string Classes to add to the table container. object HTML attributes (for example data attributes) to add to the table container. Options for `rows` array objects string **Required.** If `html` is set, this is not required. Text for cells in table rows. If `html` is provided, the `text` option will be ignored. string **Required.** If `text` is set, this is not required. HTML for cells in table rows. If `html` is provided, the `text` option will be ignored. string Specify format of a cell. Currently we only use “numeric”. string Classes to add to the table row cell. integer Specify how many columns a cell extends. integer Specify how many rows a cell extends. object HTML attributes (for example data attributes) to add to the table cell. Options for `head` array objects string If `html` is set, this is not required. Text for table head cells. If `html` is provided, the `text` option will be ignored. string If `text` is set, this is not required. HTML for table head cells. If `html` is provided, the `text` option will be ignored. string Specify format of a cell. Currently we only use “numeric”. string Classes to add to the table head cell. integer Specify how many columns a cell extends. integer Specify how many rows a cell extends. object HTML attributes (for example data attributes) to add to the table cell. ``` {% from "govuk/components/table/macro.njk" import govukTable %} {{ govukTable({ caption: "Month you apply", captionClasses: "govuk-table__caption--m", firstCellIsHeader: true, head: [ { text: "Date", classes: "app-custom-class" }, { text: "Rate for vehicles", classes: "app-custom-class" }, { text: "Rate for bicycles", classes: "app-custom-class" } ], rows: [ [ { text: "First 6 weeks" }, { text: "£109.80 per week" }, { text: "£59.10 per week" } ], [ { text: "Next 33 weeks" }, { text: "£159.80 per week" }, { text: "£89.10 per week" } ], [ { text: "Total estimated pay" }, { text: "£4,282.20" }, { text: "£2,182.20" } ] ] }) }} ``` ## Tables with a lot of data If possible, you should aim to have less data in your tables. If you have a lot of data, try to organise it into multiple tables or multiple pages. If you cannot split your data, you can use the CSS class `govuk-table--small-text-until-tablet`. This class reduces the size of the text on small screens so large amounts of data has more empty space around it. This makes it easier to visually differentiate between each piece of data when read on small screens. The CSS class `govuk-table--small-text-until-tablet` is only available in version 5.2 of GOV.UK Frontend and later. Read about [updating your service to use the new type scale](/get-started/new-type-scale/). You should not use this class on tables unless your table has a lot of data, because a smaller amount of data is easier to read if the text is larger. - HTML - Nunjucks HTML ```
Dates and amounts
Date First amount Second amount
First 3 weeks ÂŁ27.45 per week ÂŁ33.90 per week
Next 6 weeks ÂŁ27.45 per week ÂŁ33.90 per week
Next 24 weeks ÂŁ27.45 per week ÂŁ33.90 per week
Next 33 weeks ÂŁ27.45 per week ÂŁ33.90 per week
Total estimated pay ÂŁ4,282.20 ÂŁ5,288.40
``` Nunjucks Nunjucks macro options Use options to customise the appearance, content and behaviour of a component when using a macro, for example, changing the text. Some options are required for the macro to work; these are marked as “Required” in the option description. Deprecated options are marked as “Deprecated”. If you’re using Nunjucks macros in production with “html” options, or ones ending with “html”, you must sanitise the HTML to protect against [cross-site scripting exploits](https://developer.mozilla.org/en-US/docs/Glossary/Cross-site_scripting). Primary options array **Required.** The rows within the table component. See macro options for rows. array Can be used to add a row of table header cells (``) at the top of the table component. See macro options for head. string Caption text. string Classes for caption text size. Classes should correspond to the available typography heading classes. boolean If set to `true`, the first cell in each row will be a table header (``). string Classes to add to the table container. object HTML attributes (for example data attributes) to add to the table container. Options for `rows` array objects string **Required.** If `html` is set, this is not required. Text for cells in table rows. If `html` is provided, the `text` option will be ignored. string **Required.** If `text` is set, this is not required. HTML for cells in table rows. If `html` is provided, the `text` option will be ignored. string Specify format of a cell. Currently we only use “numeric”. string Classes to add to the table row cell. integer Specify how many columns a cell extends. integer Specify how many rows a cell extends. object HTML attributes (for example data attributes) to add to the table cell. Options for `head` array objects string If `html` is set, this is not required. Text for table head cells. If `html` is provided, the `text` option will be ignored. string If `text` is set, this is not required. HTML for table head cells. If `html` is provided, the `text` option will be ignored. string Specify format of a cell. Currently we only use “numeric”. string Classes to add to the table head cell. integer Specify how many columns a cell extends. integer Specify how many rows a cell extends. object HTML attributes (for example data attributes) to add to the table cell. ``` {% from "govuk/components/table/macro.njk" import govukTable %} {{ govukTable({ caption: "Dates and amounts", captionClasses: "govuk-table__caption--m", firstCellIsHeader: true, classes: "govuk-table--small-text-until-tablet", head: [ { text: "Date" }, { text: "First amount" }, { text: "Second amount" } ], rows: [ [ { text: "First 3 weeks" }, { text: "£27.45 per week" }, { text: "£33.90 per week" } ], [ { text: "Next 6 weeks" }, { text: "£27.45 per week" }, { text: "£33.90 per week" } ], [ { text: "Next 24 weeks" }, { text: "£27.45 per week" }, { text: "£33.90 per week" } ], [ { text: "Next 33 weeks" }, { text: "£27.45 per week" }, { text: "£33.90 per week" } ], [ { text: "Total estimated pay" }, { text: "£4,282.20" }, { text: "£5,288.40" } ] ] }) }} ``` ## Help improve this component To help make sure that this page is useful, relevant and up to date, you can: - take part in the [�Table’ discussion on GitHub](https://github.com/alphagov/govuk-design-system-backlog/issues/61) and share your research - [propose a change on GitHub](https://github.com/alphagov/govuk-design-system/edit/main/src/components/table/index.md) – read more about [how to propose changes in GitHub](/community/propose-a-content-change-using-github/) ## Need help? If you’ve got a question about the GOV.UK Design System, [contact the team](/contact/).