Skip to content

Commit

Permalink
add updated caption styles to table conponent
Browse files Browse the repository at this point in the history
  • Loading branch information
CharlotteDowns committed Jan 28, 2021
1 parent cc6f8ab commit 108cb86
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 0 deletions.
46 changes: 46 additions & 0 deletions src/components/table/caption-m/index.njk
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
---
title: Custom caption size
layout: layout-example.njk
---

{% 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"
}
]
]
}) }}
4 changes: 4 additions & 0 deletions src/components/table/index.md.njk
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ Never use the table component to layout content on a page. Instead, use the [gri

Use the `<caption>` 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 different from the default.

This comment has been minimized.

Copy link
@calvin-lau-sig7

calvin-lau-sig7 Jan 29, 2021

Contributor

Any chance we can describe a bit more about what these do? Is it just text size?

E.g.
...to make them larger or smaller from the default.


{{ example({group: "components", item: "table", example: "caption-m", html: true, nunjucks: true, open: false, size: "m"}) }}

### 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.
Expand Down

0 comments on commit 108cb86

Please sign in to comment.