1. Collections Component Guide
  2. Contents list
  3. Formats complex numbers
Contents list example

Formats complex numbers

How it looks (preview)

How to call this example

<%= render "govuk_publishing_components/components/contents_list", {
  format_numbers: true,
  contents: [
    {
      href: "#",
      text: "1. Item"
    },
    {
      href: "#",
      text: "1.1 Sub item"
    },
    {
      href: "#",
      text: "1.2 Sub item"
    },
    {
      href: "#",
      text: "1.02 longer decimals allowed"
    },
    {
      href: "#",
      text: "1.021 even longer decimals ignored"
    },
    {
      href: "#",
      text: "1 Number without period"
    },
    {
      href: "#",
      text: "10. Two digit numbers"
    },
    {
      href: "#",
      text: "99. Two digit numbers"
    },
    {
      href: "#",
      text: "100. Three digit numbers"
    },
    {
      href: "#",
      text: "2017 four digit numbers ignored"
    },
    {
      href: "#",
      text: "2001: A space odyssey"
    }
  ]
} %>