πŸ‘€ Our most exciting product launch yet πŸš€ Join us May 8th for Sanity Connect

Declaring Nested Lists the Block Type for PortableText

1 replies
Last updated: Jan 5, 2023
Hello, I have these nested lists,
ul
and
ol
, but I don't know how to declare the block type of these lists in order to use them in PortableText
Jan 5, 2023, 5:36 PM
I just saw I can use this:
 list: {
    // Ex. 1: customizing common list types
    bullet: ({children}) => <ul className="mt-xl">{children}</ul>,
    number: ({children}) => <ol className="mt-lg">{children}</ol>,

    // Ex. 2: rendering custom lists
    checkmarks: ({children}) => <ol className="m-auto text-lg">{children}</ol>,
  },

Jan 5, 2023, 5:56 PM

Sanity– build remarkable experiences at scale

Sanity is a modern headless CMS that treats content as data to power your digital business. Free to get started, and pay-as-you-go on all plans.

Was this answer helpful?