Class TJSSvgFolder
Hierarchy
- SvelteComponent<TJSSvgFolder.Props, TJSSvgFolder.Events, TJSSvgFolder.Slots>
- TJSSvgFolder (view full)
Index
Constructors
Methods
Constructors
constructor
- new TJSSvg
Folder (options): TJSSvgFolder Parameters
- options: ComponentConstructorOptions<TJSSvgFolder.Props>
Returns TJSSvgFolder
Methods
$destroy
$on
- $on<K>(type, callback): (() => void)
Type Parameters
Parameters
- type: K
- callback: ((e: TJSSvgFolder.Events[K]) => void)
- (e): void
Parameters
- e: TJSSvgFolder.Events[K]
Returns void
Returns (() => void)
- (): void
Returns void
$set
- $set(props): void
Parameters
- props: Partial<TJSSvgFolder.Props>
Returns void
TJSFolder provides a collapsible folder using the details and summary HTMLElements.
This is a slotted component. The default slot is the collapsible contents. There are also two additional optional named slots available for the summary element.
label
allows setting custom content with the fallback being thelabel
string. Additionally,summary-end
allows a component or text to be slotted after the label. This can be useful for say an "expand all" button.Exported props
folder
(TJSFolderData): An object defining all properties of a folder including potentially data driven minimal Svelte configuration objects (slotDefault
,slotLabel
, andslotSummaryEnd
) providing default component implementations.Or in lieu of passing the folder object you can assign these props directly:
id
: Anything used for an ID.-
label
: The label name of the folder; string.-
store
: The store tracking the open / close state: Writable-
styles
: Styles to be applied inline viaapplyStyles
action.Events
There are several events that are fired and / or bubbled up through parent elements. There are four custom events that pass a details object including:
the details element, id, label, and store
.The following events are bubbled up such that assigning a listener in any parent component receives them from all children folders:
click
- Basic MouseEvent of folder being clicked.keydown
- Key down event.keyup
- Key up event.closeAny
- Triggered when any child folder is closed w/ details object.openAny
- Triggered when any child folder is opened w/ details object.The following events do not propagate / bubble up and can be registered with:
close
- Triggered when direct descendent folder is closed w/ details object.open
- Triggered when direct descendent folder is opened w/ details object.Styling: To style this component use
details.tjs-folder
as a selector. Each element also contains data attributes forid
andlabel
.There are several local CSS variables that you can use to change the appearance dynamically. Either use CSS props or pass in a
styles
object w/ key / value props to set to the details element.CSS Variables
The following CSS variables are supported, but not defined by default: