LinkSectionEditor
An inline editor for hierarchical sections of links — each section has a header and a list of link items (text, url, newTab). Designed for things like footer link columns or megamenu sections.
Keyboard behavior is built-in:
Enteron an item adds a new link below.Cmd/Ctrl+Enteron a header or item creates a new section after the current one.Backspaceon an empty item removes it; on an empty header removes the whole section.
import { LinkSectionEditor } from '@eightshift/frontend-libs-tailwind/scripts';
<LinkSectionEditor links={links} onChange={(newLinks) => setAttributes({ links: newLinks })} classNames={{ sectionContainer: 'section-container', sectionTitle: 'section-title', link: 'link', }}/>;Data shape
Section titled “Data shape”const links = [ { header: 'Section 1', items: [ { text: 'Link 1', url: 'https://example.com', newTab: false }, { text: 'Link 2', url: 'https://example.com', newTab: false }, ], }, { header: 'Section 2', items: [{ text: 'Link 1', url: 'https://example.com', newTab: false }], },];Highlighted props
Section titled “Highlighted props”| Prop | Type | Description |
|---|---|---|
links | Array<{ header: string, items: Array<{ text: string, url: string, newTab: boolean }> }> | Required. Current link sections. |
onChange | (newLinks) => void | Required. Called with the updated array whenever a section, header, or item changes. |
classNames | { sectionContainer?: string, sectionTitle?: string, link?: string } | CSS classes forwarded to the section wrapper, the header RichText, and each link RichText. |