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 29, 2021
1 parent cc6f8ab commit 4998fa5
Show file tree
Hide file tree
Showing 6 changed files with 54 additions and 0 deletions.
46 changes: 46 additions & 0 deletions src/components/table/caption-l/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: "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"
}
]
]
}) }}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ stylesheets:

{{ govukTable({
caption: "Month you apply",
captionClasses: "govuk-table__caption--m",
firstCellIsHeader: true,
head: [
{
Expand Down
1 change: 1 addition & 0 deletions src/components/table/column-widths/index.njk
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ layout: layout-example.njk

{{ govukTable({
caption: "Month you apply",
captionClasses: "govuk-table__caption--m",
firstCellIsHeader: true,
head: [
{
Expand Down
1 change: 1 addition & 0 deletions src/components/table/default/index.njk
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ layout: layout-example.njk

{{ govukTable({
caption: "Dates and amounts",
captionClasses: "govuk-table__caption--m",
firstCellIsHeader: true,
head: [
{
Expand Down
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

Can we be a bit more descriptive what the classes do a bit more? Is it just text size?

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

This comment has been minimized.

Copy link
@CharlotteDowns

CharlotteDowns Feb 1, 2021

Author Contributor

ooo I like


{{ example({group: "components", item: "table", example: "caption-l", 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
1 change: 1 addition & 0 deletions src/components/table/numbers/index.njk
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ layout: layout-example.njk

{{ govukTable({
caption: "Months and rates",
captionClasses: "govuk-table__caption--m",
firstCellIsHeader: true,
head: [
{
Expand Down

0 comments on commit 4998fa5

Please sign in to comment.