Adding a Divider
Create a horizontal, styled divider that extends to the right edge of the display.
Overview
In Creating Your First Article, you added some text components to your article. Now, you can add a divider component to visually separate some text components and create color contrast.
On this page, you’ll learn how to create a horizontal dividing line that extends to the right edge of the display.
[Image]
Define a ComponentLayout Object that Bleeds to the Right Edge
Before you can make your divider line extend to the right edge of the display, you must define a new ComponentLayout object that uses the ignoreDocumentMargin property.
Copy the example code bigDividerLayout: Copy This Code.
Paste the code inside your
ArticleDocument.componentLayoutsobject, after the closing brace (}) of the lastComponentLayoutobject and before the closing brace for the wholecomponentLayoutsproperty.
Your code should look like the example code bigDividerLayout: Result.
bigDividerLayout: Copy This Code
,
"bigDividerLayout": {
"ignoreDocumentMargin": "right",
"columnStart": 0,
"columnSpan": 20,
"margin": {
"top": 6,
"bottom": 6
}
}bigDividerLayout: Result
Ellipses (...) indicate lines of code that have been omitted from this example.
{
...
"componentLayouts": {
...
"bigDividerLayout": {
"ignoreDocumentMargin": "right",
"columnStart": 0,
"columnSpan": 20,
"margin": {
"top": 6,
"bottom": 6
}
}
},
...
}Add a Divider in Your Article
A divider component in your JSON file represents a divider line in your article.
Copy the example code Divider: Copy This Code.
Paste the code inside the
componentsarray of your article, after the closing brace and comma (},) that endheading1component.
Your code should look like the example code Divider: Result.
After you make this change in your code, you can preview your working article.json file in News Preview to see a yellow divider.
Divider: Copy This Code
{
"role": "divider",
"layout": "bigDividerLayout",
"stroke": {
"width": 3,
"color": "#D5B327"
}
},Divider: Result
Ellipses (…) indicate lines of code that have been omitted from this example.
{
...
"components": [
...
{
"role": "divider",
"layout": "bigDividerLayout",
"stroke": {
"width": 3,
"color": "#D5B327"
}
},
...
],
...
}Further Exploration
At any time, you can try changing property values in your article.json file and then use News Preview to see how these changes affect the look of your article.
For example, try changing the layout of your article’s divider component:
In your
article.jsonfile, find theComponentLayoutobject calledbigDividerLayout.In
bigDividerLayout, find theignoreDocumentMarginproperty and replace its value ("right") with"both".Preview your
article.jsonfile in News Preview.
The divider now ignores the margins on both sides of the document.