Documentation

Complete API reference for MaterialSB components and functions.

Introduction

MaterialSB is a SpiderBasic library that replaces the default Dojo-based UI with MaterializeCSS components. It provides a familiar BASIC syntax for creating modern, responsive Material Design interfaces.

Key Concepts:

  • Parent Stack System: Components like Row(), Col(), Card(), and Modal sections automatically manage a parent hierarchy. Use CloseCurrentParent() to navigate back up the tree.
  • Initialization Required: Some components (Carousel, Dropdown, Sidenav, Modal) require calling Init() after creation.
  • Color Constants: Use built-in color constants like #Color_Red, #Color_Blue with modifiers like #Color_Darken_2.

Library Initialization

Before using any MaterialSB components, you must initialize the library by downloading its CSS and JavaScript dependencies.

  • Download()

    Downloads the MaterialSB CSS and JavaScript dependencies. This must be called first.

  • AutoInit()

    Automatically initializes all Materialize components found in the document.

  • Init()

    Initializes a specific Materialize component (Carousel, Dropdown, Sidenav, or Modal).

Parent Management

MaterialSB uses a parent stack to manage hierarchical element creation. Container components automatically push themselves onto the stack, and you use these functions to navigate the hierarchy.

HTML Helpers

Utility functions for generating HTML content and working with elements.

  • Paragraph()

    Returns an HTML paragraph string with optional color. Supports newline characters.

  • Paragraph_ex()

    Returns an HTML paragraph with custom CSS class and inline style.

  • Header()

    Returns an HTML header element (h1-h6) with optional color.

  • Header_ex()

    Returns an HTML header with custom CSS class and inline style.

  • Link()

    Returns an HTML anchor element with a click callback and optional color.

  • Link_ex()

    Returns an HTML anchor with custom CSS class and inline style.

  • Append()

    Appends HTML content string to the current or specified parent element.

Element Manipulation

Low-level functions for directly manipulating DOM element properties.

  • SetAttribute()

    Sets an HTML attribute on an element.

  • SetClass()

    Replaces the entire CSS class list of an element.

  • AddClass()

    Adds one or more CSS classes to an element (space-separated).

  • SetContent()

    Replaces the inner HTML content of an element.

  • AddContent()

    Appends HTML content to an element's existing content.

  • GetValue()

    Returns the current value of a form input element.

  • SetValue()

    Sets the value of a form input element.

Theme Management

MaterialSB supports both light and dark themes. Dark theme is enabled by default after calling Download().

Colors

MaterialSB provides constants for all Material Design colors, with modifiers for shades and text colors.

  • Color Constants

    Complete reference for all color constants, modifiers, and usage patterns.

Sidenav

Slide-out navigation menus for mobile or as a fixed sidebar. Requires Init() after creation.

Grid

MaterializeCSS 12-column responsive grid system. Both Row() and Col() push to the parent stack.

  • Row()

    Creates a grid row container. Pushes to parent stack.

  • Col()

    Creates a responsive column with breakpoint-specific widths. Pushes to parent stack.

Media

Display images, videos, and embedded YouTube content with responsive options.

  • Image()

    Creates an image element with optional responsive and circular styles.

  • Video()

    Creates a video element with optional controls and responsive sizing.

  • YoutubeVideo()

    Embeds a YouTube video with optional responsive container.

Table

Create data tables with striping, hover highlighting, and responsive scrolling.

  • Table()

    Creates a table with the first column header defined.

  • TableAddColumn()

    Adds an additional column header to the table.

  • TableAddItem()

    Adds a data row with newline-separated column values.

  • TableSetText()

    Sets the text content of a specific table cell.

Buttons

Material Design buttons with multiple variants: filled, tonal, outlined, elevated, text, and floating action buttons.

  • Button()

    Creates a button with click callback and style variants.

  • ButtonSetCallback()

    Sets or changes the click callback for an existing button.

Cards

Material Design cards for content grouping. Card() pushes to the parent stack.

  • Card()

    Creates a card container with optional panel mode and sizing.

  • CardImage()

    Adds an image section to a card.

  • CardContent()

    Creates the main content area of a card. Pushes to parent stack.

  • CardTitle()

    Adds a title element inside a card.

  • CardAction()

    Creates an action area for links and buttons. Pushes to parent stack.

Tabs

Tabbed content navigation for organizing related content.

  • Tab()

    Creates a tab container element.

  • TabAddItem()

    Adds a tab item that links to a content div by ID.

Modals

Dialog windows and bottom sheets using the modern Popover API. Requires Init() after creation.

Toasts

Temporary notification messages that appear at the bottom of the screen.

  • Toast()

    Displays a toast notification with customizable duration and color.

  • ToastDismissAll()

    Dismisses all currently visible toast notifications.

Form Components

Input fields, checkboxes, radio buttons, switches, dropdowns, and sliders. Dropdown requires Init().

  • TextInput()

    Creates a text input field with various type options (text, password, email, etc.).

  • Textarea()

    Creates a multiline text area input.

  • Checkbox()

    Creates a checkbox input with optional filled style.

  • Radio()

    Creates a radio button. Use the same Name for grouped options.

  • Switch()

    Creates a toggle switch with off/on labels.

  • Range()

    Creates a range slider with min, max, and initial value.

  • Dropdown()

    Creates a dropdown select element. Requires Init() after adding options.

  • DropdownAddOption()

    Adds an option to a dropdown with text, value, and selected state.

  • InputSetCallback()

    Registers a callback function for input value changes.