✨ UI部品初級
区切り線
ページ内の要素を視覚的に区切るための水平線セクション。色・透明度・高さをカスタマイズでき、上下の余白も調整できる。
用途
ページ内で異なるセクション間に視覚的な区切りを入れたいときに使う。商品説明とレビューの間、複数のバナー間など、セクションの境目を明確にしたい箇所に配置する。
設置場所
sections/separator.liquid に配置し、テーマカスタマイザーまたはテンプレートで「セクションを追加」メニューから「区切り線」を選んで挿入する。
注意点
max_width の CSS 変数は `section.settings.max_width` で指定されているが、スキーマには `container_max_width` しか存在するため、実際の動作を確認したうえで両者を統一する必要がある。背景色のクラス名(`bg-primary`、`bg-secondary` など)は Bootstrap のカラー変数に依存しているため、テーマの CSS で該当クラスが定義されていることが前提となる。透明度は CSS カスタムプロパティ `--bs-bg-opacity` で制御されるため、ブラウザの CSS 変数非対応環境では見た目が異なる可能性がある。
コード
110 行 / liquid<div
id="separator-wrapper-{{ section.id }}"
class="
separator-wrapper
{{ section.settings.pt | prepend: 'pt-' }}
{{ section.settings.pb | prepend: 'pb-' }}
">
<div
class="{{ section.settings.container }}"
style="max-width: {{ section.settings.max_width }}px;">
<hr
class="separator my-0 {{ section.settings.bg_color }}"
style="
opacity: 1;
--bs-bg-opacity: {{ section.settings.bg_opacity | append: '%' }};
height: {{ section.settings.height | append: 'px' }}
">
</div>
</div>
{% schema %}
{
"name": "Separator",
"settings": [
{
"type": "header",
"content": "Styling"
},
{
"type": "select",
"id": "bg_color",
"label": "Background color",
"default": "bg-primary",
"options": [
{ "value": "bg-primary", "label": "Primary" },
{ "value": "bg-secondary", "label": "Secondary" },
{ "value": "bg-body", "label": "Body" },
{ "value": "bg-white", "label": "White" }
]
},
{
"type": "range",
"id": "bg_opacity",
"label": "Background opacity",
"min": 0,
"max": 100,
"step": 1,
"default": 10,
"unit": "%"
},
{
"type": "range",
"id": "height",
"label": "Height",
"min": 0,
"max": 16,
"default": 1,
"step": 1,
"unit": "px"
},
{
"type": "header",
"content": "General"
},
{
"type": "select",
"id": "container",
"label": "Container",
"default": "",
"options": [
{ "value": "container", "label": "Yes" },
{ "value": "", "label": "No" }
]
},
{
"type": "text",
"id": "container_max_width",
"label": "Container max-width (px)",
"info": "Leave empty to use the global container width"
},
{
"type": "header",
"content": "Spacing"
},
{
"type": "range",
"id": "pt",
"label": "Top",
"min": 0,
"max": 20,
"step": 1,
"default": 10
},
{
"type": "range",
"id": "pb",
"label": "Bottom",
"min": 0,
"max": 20,
"step": 1,
"default": 10
}
],
"presets": [
{
"name": "Separator"
}
]
}
{% endschema %}出典・ライセンス
- Repository:
- https://github.com/kondasoft/ks-bootshop
- License:
- MIT
このコードは kondasoft 著作の MIT ライセンスソースです。 原本の著作権は kondasoft が保有します。日本語訳は ALSEL によるものです。
関連項目
✨ UI部品初級
成功チェックマークアイコン
緑色の円形背景にチェックマークを描いたSVGアイコン。フォームやメッセージの完了状態を視覚的に表現する。
📁 shopify-headless-theme·MIT·6 行
✨ UI部品初級
エラーアイコン
エラー状態を示す円形アイコン。SVG で描画されたアラート記号を含む UI 部品で、accessibility 対応により視覚障害ユーザーには非表示。
📁 theme-tools·MIT·8 行
✨ UI部品中級
カスタム要素のラッパーコンポーネント
child-element というカスタム HTML 要素をラップし、スロットに子要素を挿入するスニペット。Web Components パターンで再利用可能なコンポーネント構造を実現する。
📁 theme-tools·MIT·10 行
✨ UI部品初級
静的コンテンツ
管理画面で入力したテキストコンテンツを静的に描画するブロック。セクション内で複数回使い分けられる汎用コンテナとして機能する。
📁 theme-tools·MIT·11 行
✨ UI部品初級
テキスト
セクションに追加できるシンプルなテキストブロック。管理画面からドラッグ&ドロップで配置でき、固定テキスト「hello world」を表示する基本的なブロック実装。
📁 theme-tools·MIT·15 行
✨ UI部品初級
セクション共通ヘッダー(タイトル・説明文)
セクション内で繰り返し使うタイトルと説明文をまとめて描画するスニペット。テーマカスタマイザーから設定したテキストとフォントサイズを条件付きで出力する。
📁 ks-bootshop·MIT·24 行