{ "cells": [ { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "import panel as pn\n", "import panel.widgets as pnw\n", "\n", "pn.extension()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "A `Divider` draws a horizontal rule (a `
` tag in HTML) to separate multiple components in a layout. It automatically spans the full width of the container.\n", "___\n", "\n", "## Divider" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The `Divider` is useful for clearly separating different components in a panel:" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "text = \"\"\"\n", "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt\n", "ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation \n", "ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in\n", "reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.\n", "Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt\n", "mollit anim id est laborum.\n", "\"\"\"\n", "\n", "pn.Column(\n", " '# Lorem Ipsum',\n", " pn.layout.Divider(),\n", " text,\n", " styles=dict(background='whitesmoke'),\n", " width=400,\n", ")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "If we enable responsive sizing on the container (or globally) the `Divider` will automatically span the full width:" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "pn.config.sizing_mode='stretch_width'\n", "\n", "pn.Column(\n", " '## Slider',\n", " pn.layout.Divider(margin=(-20, 0, 0, 0)),\n", " pn.Row(\n", " pnw.FloatSlider(name='Float'), pnw.IntSlider(name='Int'),\n", " pnw.RangeSlider(name='Range'), pnw.IntRangeSlider(name='Int Range')\n", " ),\n", " '## Input',\n", " pn.layout.Divider(margin=(-20, 0, 0, 0)),\n", " pn.Row(\n", " pnw.TextInput(name='Text'), pnw.DatetimeInput(name='Date'),\n", " pnw.PasswordInput(name='Password'), pnw.Spinner(name='Number')\n", " )\n", ")" ] } ], "metadata": { "language_info": { "name": "python", "pygments_lexer": "ipython3" } }, "nbformat": 4, "nbformat_minor": 4 }