Sha256: 00d204c472a4b4a4f062c2d29afac463bc768098ffc288c572eb666cd48ddf57

Contents?: true

Size: 1.8 KB

Versions: 4

Compression:

Stored size: 1.8 KB

Contents

name: Print link
description: A link with a print icon to help users print the current page
body: |
  This component renders two different outputs depending on whether a `href` is specified. By default, when no `href` is given, the component renders as a button and triggers a print action via JavaScript. In this case the component is hidden in environments where JavaScript is disabled and can be used as a progressive enhancement. When a `href` is specified the component renders as an anchor tag and navigates to that `href` without JavaScript, suitable for applications which have paths that trigger a print event on load.
accessibility_criteria: |
  - The print icon must be presentational and ignored by screen readers.
shared_accessibility_criteria:
  - link
uses_component_wrapper_helper: true
examples:
  default:
    description: This component calls `print()` via the browser's DOM API. By default it relies on JavaScript and is not shown in environments where JavaScript is disabled. The \"link\" here is actually a button tag because this is not a navigation event.
  with_different_text:
    data:
      text: "Print this manual"
  with_different_href:
    description: You can specify a alternative `href` URL that will override the default behaviour. When a `href` is specified the print link will render as an anchor tag and be displayed even when JavaScript is disabled.
    data:
      href: "/print"
  with_child_data_attributes:
    description: |
      Data attributes can be passed to the link/button as shown.

      Note that the component does not include built in tracking. If this is required consider using the [GA4 link tracker](https://github.com/alphagov/govuk_publishing_components/blob/main/docs/analytics-ga4/trackers/ga4-link-tracker.md).
    data:
      child_data_attributes:
        an_attribute: some_value

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
govuk_publishing_components-51.1.0 app/views/govuk_publishing_components/components/docs/print_link.yml
govuk_publishing_components-51.0.0 app/views/govuk_publishing_components/components/docs/print_link.yml
govuk_publishing_components-50.0.1 app/views/govuk_publishing_components/components/docs/print_link.yml
govuk_publishing_components-50.0.0 app/views/govuk_publishing_components/components/docs/print_link.yml