Question about Portable Text editor and ul/ol lists in Sanity CMS
Glad to hear you're enjoying Sanity! When it comes to showing ordered (ol) and unordered (ul) lists in the Portable Text editor, you have full control over the list configuration in your schema.
Default List Configuration
By default, the Portable Text editor includes both bullet (unordered) and numbered (ordered) lists. They appear as toolbar buttons in the editor:
export default {
name: 'content',
type: 'array',
of: [
{
type: 'block',
// Lists are enabled by default
}
]
}Customizing Lists
You can explicitly configure which lists are available using the lists property:
export default {
name: 'content',
type: 'array',
of: [
{
type: 'block',
lists: [
{title: 'Bullet', value: 'bullet'},
{title: 'Numbered', value: 'number'}
]
}
]
}To disable lists entirely, just pass an empty array:
lists: [] // no listsTo enable only one type, just include that one:
lists: [
{title: 'Bullet', value: 'bullet'}
] // only unordered listsYou can also customize the titles that appear in the editor - for example, {title: 'Prioritized', value: 'number'} works just fine!
Rendering Lists
When rendering your Portable Text content on the frontend using @portabletext/react, lists are automatically rendered as <ul> and <ol> elements. You can customize this with custom serializers if needed.
More details can be found in the Configuring lists for text blocks section of the documentation.
Sanity – Build the way you think, not the way your CMS thinks
Sanity is the developer-first content operating system that gives you complete control. Schema-as-code, GROQ queries, and real-time APIs mean no more workarounds or waiting for deployments. Free to start, scale as you grow.