Lists
note
Lists are rendered with an internal renderer. See ​Rendering page. The content model of lists is ​block
, see ​Element Models.
tip
Lists marker rendering logic has been extracted to ​@jsamr/react-native-li
and ​@jsamr/counter-style
libraries for convinience! Fell free to use these outside of a ​RenderHTML
component.
#
List Style TypeList elements support ​list-style-type
CSS property, which defines how the marker pseudo-element of a list item should be rendered. In CSS terminology, a marker is a pseudo-element situated before elements with a ​display
property set to list-item
. See CSS Lists and Counters Module Level 3 for a standard reference and ​DefaultSupportedListStyleType
for a list of types supported by this library.
#
Ordered ListsOrdered lists ​<ol>
elements support by default 6 list style types:
decimal
: 1, 2, 3 ... (the default)lower-alpha
: a, b, c ...upper-alpha
: A, B, C ...lower-greek
: α, β, γ ...lower-roman
: i, ii, iii ...upper-roman
: I, II, III ...
tip
You can actually very easily plug-in one of the dozens presets from ​@jsamr/counter-style
, including Persian, Arabic, Hebrew, Thai, Katana... see the below chapter.
#
Unordered ListsUnordered lists ​<ul>
elements support by default 5 list style types:
disc
: "•" (the default)square
: "â– "circle
: "â—‹"disclosure-open
: "â–¼"disclosure-closed
: "â–¶"
note
Those markers are not rendered with UTF-8 characters, which might have a significant variety of shapes and sizes depending on fonts. Instead, geometric shapes are rendered.
#
Defining and Customizing Markers Pseudo-Elements#
Using a Preset from @jsamr/counter-styleThe ​customListStyleSpecs
prop allows you to create as many list type styles as you wish. Combined with the power of ​@jsamr/counter-style
, you can plug-in one of the dozens of presets with a one-liner! See below example with the Thai preset:
#
Creating a Counter Style​@jsamr/counter-style
allows you to create any counter style, translating strictly the ​@counter-style
at-rule API defined in CSS Counter Styles Level 3 in a JavaScript API. In the below example, we are going to create an alphabetic counter style for the Russian alphabet:
#
Experimental RTL ModeThanks to ​renderersProps
prop, you can enable experimental RTL support for lists (see ​RenderersProps.ol
and ​RenderersProps.ul
).