Segment

A calendar segment is a part of the calendar that represents a single appointment.

Import
the javascript logo
import { Segment } from "@schukai/monster/source/components/time/timeline/segment.mjs";
Source
the git logo
Package
the npm logo
Since
3.112.0
Support Rotation

Introduction

monster-appointment-segment represents a broader labeled segment in a timeline, such as a shift, block, or schedule section.

Key Features

  • Segment label: Displays a short descriptive block title.
  • Reusable timeline primitive: Works as a structural timeline marker.
  • Minimal API: Keeps the segment focused on label rendering.

Segment Simple

This example renders a single timeline segment label to represent a broader calendar slot.

Javascript

/** this example does not use an extra script **/

HTML

<div style="display:grid;gap:var(--monster-space-2);">
  <monster-appointment-segment data-monster-option-labels-text="Morning shift"></monster-appointment-segment>
  <monster-appointment-segment data-monster-option-labels-text="Core overlap"></monster-appointment-segment>
  <monster-appointment-segment data-monster-option-labels-text="Evening handover"></monster-appointment-segment>
</div>

Stylesheet

/** no additional stylesheet is defined **/
Open in playground

Component Design

The segment component mirrors the same simple structure as the appointment component but is intended for broader grouped periods instead of a single appointment item.

Styling Hooks

  • ::part(control): Styles the segment wrapper.
  • ::part(appointment): Styles the visible segment label.

HTML Structure

<monster-segment></monster-segment>

JavaScript Initialization

const element = document.createElement('monster-segment');
document.body.appendChild(element);

Exported

Segment

Derived from

CustomElement

Options

The Options listed in this section are defined directly within the class. This class is derived from several parent classes, including the CustomElement class. Therefore, it inherits Options from these parent classes. If you cannot find a specific Options in this list, we recommend consulting the documentation of the CustomElement.

Option
Type
Default
Description
templates
object
Template definitions
templates.main
string
undefined
Main template
labels
object
Label definitions
actions
object
undefined
Callbacks
actions.click
string
throw Error
features
object
undefined
Features
classes
object
undefined
CSS classes
disabled
boolean
false

  • since
  • deprecated

Properties and Attributes

The Properties and Attributes listed in this section are defined directly within the class. This class is derived from several parent classes, including the CustomElement class and ultimately from HTMLElement. Therefore, it inherits Properties and Attributes from these parent classes. If you cannot find a specific Properties and Attributes in this list, we recommend consulting the documentation of the CustomElement.

  • data-monster-options: Sets the configuration options for the collapse component when used as an HTML attribute.
  • data-monster-option-[name]: Sets the value of the configuration option [name] for the collapse component when used as an HTML attribute.

Methods

The methods listed in this section are defined directly within the class. This class is derived from several parent classes, including the CustomElement class and ultimately from HTMLElement. Therefore, it inherits methods from these parent classes. If you cannot find a specific method in this list, we recommend consulting the documentation of the CustomElement.

Static methods

[instanceSymbol]()
This method is called by the instanceof operator.
getCSSStyleSheet()
Returns
  • {CSSStyleSheet[]}
getTag()
Returns
  • {string}

Lifecycle methods

Lifecycle methods are called by the environment and are usually not intended to be called directly.

[assembleMethodSymbol]()
Returns
  • {Components.Time.Calendar

Events

This component does not fire any public events. It may fire events that are inherited from its parent classes.

The current width of the area is too small to display the content correctly.