You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I can't find any information on how I can target and style nested lists.
Sanity uses "a series of list item blocks with the same level and listItem properties will be grouped into a virtual one inside of this library." My rich text is inputted as follows
Here is how I handled it. Keep in mind this only handles two levels since that was all I needed.
constcomponents: PortableTextComponents={list: ({ value, children })=>{const{ level, listItem }=value;if(listItem==='bullet'){return<ulclassName="list-disc list-inside">{children}</ul>;}if(listItem==='number'){if(level===1){return<olclassName={'list-decimal ml-6'}>{children}</ol>;}elseif(level===2){return<olclassName={'list-[lower-alpha] ml-4'}>{children}</ol>;}}else{// Handle other list types if neededreturnnull;}}}
I can't find any information on how I can target and style nested lists.
Sanity uses "a series of list item blocks with the same level and listItem properties will be grouped into a virtual one inside of this library." My rich text is inputted as follows
and is seen queried like this:
But is rendered without grouping the level 2 items with the same indentation treatment?
How can we target the second level to style them properly? Am I misunderstanding how the grouping of levels should be operating?
The text was updated successfully, but these errors were encountered: