Cards (experimental)
A grid of cards that have a link and a description
The component renders the cards as an unordered list element and visually presents it as a grid. It doesn’t use the GOV.UK Design System grid but sets its own so that it can separately target desktop, tablet and mobile columns.
You can display the grid in three or two columns on desktop. Browsers that don’t support CSS grid always display one column.
You must set a href
for all the links.
This component is currently experimental. If you are using it, please feed back any research findings to the GOV.UK Explore team.
How it looks (preview) (preview all)
Services and information
-
Benefits
Includes eligibility, appeals, tax credits and Universal Credit
-
Births, deaths, marriages and care
Parenting, civil partnerships, divorce and Lasting Power of Attorney
-
Business and self-employed
Tools and guidance for businesses
-
Childcare and parenting
Includes giving birth, fostering, adopting, benefits for children, childcare and schools
-
Citizenship and living in the UK
Voting, community participation, life in the UK, international projects
-
Crime, justice and the law
Legal processes, courts and the police
-
Disabled people
Includes carers, your rights, benefits and the Equality Act
-
Driving and transport
Includes vehicle tax, MOT and driving licences
-
Education and learning
Includes student loans, admissions and apprenticeships
-
Employing people
Includes pay, contracts, hiring and redundancies
-
Environment and countryside
Includes flooding, recycling and wildlife
-
Housing and local services
Owning or renting and council services
How to call this component
<%= render "govuk_publishing_components/components/cards", {
heading: "Services and information",
items: [
{
link: {
text: "Benefits",
path: "http://www.gov.uk"
},
description: "Includes eligibility, appeals, tax credits and Universal Credit"
},
{
link: {
text: "Births, deaths, marriages and care",
path: "http://www.gov.uk"
},
description: "Parenting, civil partnerships, divorce and Lasting Power of Attorney"
},
{
link: {
text: "Business and self-employed",
path: "http://www.gov.uk"
},
description: "Tools and guidance for businesses"
},
{
link: {
text: "Childcare and parenting",
path: "http://www.gov.uk"
},
description: "Includes giving birth, fostering, adopting, benefits for children, childcare and schools"
},
{
link: {
text: "Citizenship and living in the UK",
path: "http://www.gov.uk"
},
description: "Voting, community participation, life in the UK, international projects"
},
{
link: {
text: "Crime, justice and the law",
path: "http://www.gov.uk"
},
description: "Legal processes, courts and the police"
},
{
link: {
text: "Disabled people",
path: "http://www.gov.uk"
},
description: "Includes carers, your rights, benefits and the Equality Act"
},
{
link: {
text: "Driving and transport",
path: "http://www.gov.uk"
},
description: "Includes vehicle tax, MOT and driving licences"
},
{
link: {
text: "Education and learning",
path: "http://www.gov.uk"
},
description: "Includes student loans, admissions and apprenticeships"
},
{
link: {
text: "Employing people",
path: "http://www.gov.uk"
},
description: "Includes pay, contracts, hiring and redundancies"
},
{
link: {
text: "Environment and countryside",
path: "http://www.gov.uk"
},
description: "Includes flooding, recycling and wildlife"
},
{
link: {
text: "Housing and local services",
path: "http://www.gov.uk"
},
description: "Owning or renting and council services"
}
]
} %>
Accessibility acceptance criteria
The component must:
- use the correct heading level hierarchy eg. if the component heading uses a
<h2>
, the subheadings must use a<h3>
It is also good practise to include a heading above the list to tell users what the list contains
Links in the component must:
- accept focus
- be focusable with a keyboard
- be usable with a keyboard
- indicate when they have focus
- change in appearance when touched (in the touch-down state)
- change in appearance when hovered
- be usable with touch
- be usable with voice commands
- have visible text
- have meaningful text
Other examples
Standard options
This component uses the component wrapper helper. It accepts the following options and applies them to the parent element of the component. See the component wrapper helper documentation for more detail.
id
- accepts a string for the element ID attributedata_attributes
- accepts a hash of data attributesaria
- accepts a hash of aria attributesclasses
- accepts a space separated string of classes, these should not be used for styling and must be prefixed withjs-
role
- accepts a space separated string of roleslang
- accepts a language attribute value
Two column layout (preview)
Override default three column layout on desktop by passing through two_column_layout
parameter (defaults to false
).
-
Benefits
Includes eligibility, appeals, tax credits and Universal Credit
-
Births, deaths, marriages and care
Parenting, civil partnerships, divorce and Lasting Power of Attorney
-
Business and self-employed
Tools and guidance for businesses
-
Childcare and parenting
Includes giving birth, fostering, adopting, benefits for children, childcare and schools
-
Citizenship and living in the UK
Voting, community participation, life in the UK, international projects
-
Crime, justice and the law
Legal processes, courts and the police
-
Disabled people
Includes carers, your rights, benefits and the Equality Act
<%= render "govuk_publishing_components/components/cards", {
two_column_layout: true,
items: [
{
link: {
text: "Benefits",
path: "http://www.gov.uk"
},
description: "Includes eligibility, appeals, tax credits and Universal Credit"
},
{
link: {
text: "Births, deaths, marriages and care",
path: "http://www.gov.uk"
},
description: "Parenting, civil partnerships, divorce and Lasting Power of Attorney"
},
{
link: {
text: "Business and self-employed",
path: "http://www.gov.uk"
},
description: "Tools and guidance for businesses"
},
{
link: {
text: "Childcare and parenting",
path: "http://www.gov.uk"
},
description: "Includes giving birth, fostering, adopting, benefits for children, childcare and schools"
},
{
link: {
text: "Citizenship and living in the UK",
path: "http://www.gov.uk"
},
description: "Voting, community participation, life in the UK, international projects"
},
{
link: {
text: "Crime, justice and the law",
path: "http://www.gov.uk"
},
description: "Legal processes, courts and the police"
},
{
link: {
text: "Disabled people",
path: "http://www.gov.uk"
},
description: "Includes carers, your rights, benefits and the Equality Act"
}
]
} %>
Custom heading levels (preview)
Override default heading level by passing through heading_level
parameter (defaults to <h2>
).
Override default subheading level by passing through sub_heading_level
parameter (defaults to <h3>
)
Services and information
-
Benefits
Includes eligibility, appeals, tax credits and Universal Credit
<%= render "govuk_publishing_components/components/cards", {
heading: "Services and information",
heading_level: 3,
sub_heading_level: 4,
items: [
{
link: {
text: "Benefits",
path: "http://www.gov.uk"
},
description: "Includes eligibility, appeals, tax credits and Universal Credit"
}
]
} %>
With data attributes (preview)
Data attributes can be passed to individual links within the component as shown.
Note that the component does not include built in tracking. If this is required consider using the track click script.
-
Benefits
Includes eligibility, appeals, tax credits and Universal Credit
-
Births, deaths, marriages and care
Parenting, civil partnerships, divorce and Lasting Power of Attorney
<%= render "govuk_publishing_components/components/cards", {
items: [
{
link: {
text: "Benefits",
path: "http://www.gov.uk",
data_attributes: {
track_category: "homepageClicked",
track_action: "track-action",
track_label: "track-label",
track_dimension: "track-dimension",
track_dimension_index: 29,
track_value: 9
}
},
description: "Includes eligibility, appeals, tax credits and Universal Credit"
},
{
link: {
text: "Births, deaths, marriages and care",
path: "http://www.gov.uk",
data_attributes: {
track_category: "homepageClicked",
track_action: "track-action",
track_label: "track-label",
track_dimension: "track-dimension",
track_dimension_index: 29,
track_value: 9
}
},
description: "Parenting, civil partnerships, divorce and Lasting Power of Attorney"
}
]
} %>