Skip to content
v0.9.1
Components

Whiteboard

A board you can pan and zoom, with sticky notes, text and Momo cards you move around freely. It is the look and the feel of a whiteboard: everything stays in the page, and it tells you what changed so you can save it your way.

Try it

Drag anything to move it. Drag the empty board to pan. Double-click the board for a new note, a note to type in it, or a card to open its form. "Add card" has six kinds: a picture, a task, a checklist, a quote, a color palette and a link, each with its own form.

Open it full screen The example remembers your changes on this device; "Reset" starts over.

What you can do on it

ToMouse or fingerKeys
Move somethingDrag it (with several selected, they all move)Arrow keys, Shift for 1 pixel
ResizeDrag the round mark on the bottom corner of the selected item
PanDrag the empty board, or use the Hand tool; the wheel pans tooArrow keys with nothing selected, or hold Space and drag
ZoomCtrl + wheel, or pinch with two fingers+ -, 0 for 100%, 1 to fit everything
Add a noteDouble-click the empty board, or pick the Note tool and clickN, then click
WriteDouble-click a note, a shape or a textEnter, then Esc when done
Open a cardDouble-click it (your edit form shows)Enter
Select severalShift + click, or Shift + drag a boxCtrl + A
ColorClick a swatch (it paints what is selected)
Remove, copy, undoThe buttons in the barDel, Ctrl + D, Ctrl + Z / Y

A selected item gets a thicker border. Nothing tilts when you pick it up: a dragged item only gets a shadow.

The markup

A .board holds a toolbar and a .board-canvas with a .board-world inside. Each thing on the board is a .board-item with its place and size in data-x, data-y, data-w, data-h.

<div class="board" data-momo-board style="--board-height: 36rem">
  <div class="board-toolbar" role="toolbar" aria-label="Tools">
    <button class="btn btn-icon btn-sm btn-ghost" data-board-tool="select" aria-label="Select"><i class="mi mi-mouse-pointer-2"></i></button>
    <button class="btn btn-icon btn-sm btn-ghost" data-board-tool="note" aria-label="Sticky note"><i class="mi mi-sticky-note"></i></button>
    <button class="board-swatch bg-yellow" data-board-color="yellow" aria-label="Yellow"></button>
    <button class="btn btn-icon btn-sm btn-ghost" data-board-action="undo" aria-label="Undo"><i class="mi mi-undo-2"></i></button>
  </div>

  <div class="board-canvas">
    <div class="board-world">
      <div class="board-item board-note bg-yellow" data-id="n1" data-x="80" data-y="80" data-w="180" data-h="160">
        <div class="board-text">Free shipping for the first 100 orders</div>
      </div>
      <div class="board-item board-label" data-id="h1" data-x="80" data-y="20">
        <div class="board-text">Launch week</div>
      </div>
      <div class="board-item board-card" data-id="c1" data-x="320" data-y="80" data-w="260">
        <article class="card">…any Momo card…</article>
      </div>
    </div>
  </div>

  <div class="board-zoom">
    <button class="btn btn-icon btn-sm btn-ghost" data-board-action="zoom-out" aria-label="Zoom out"><i class="mi mi-minus"></i></button>
    <button class="btn btn-sm btn-ghost" data-board-action="zoom-reset"><span data-board-zoom-label>100%</span></button>
    <button class="btn btn-icon btn-sm btn-ghost" data-board-action="zoom-in" aria-label="Zoom in"><i class="mi mi-plus"></i></button>
  </div>
</div>

The kinds of things

ClassWhat it is
.board-note + .bg-<color>A sticky note
.board-shape.board-shape-rect, .board-shape-ellipseA box, a circle, with words in the middle (paint it with .bg-<color>). Not in the example's toolbar; add the Box and Circle tools if you want them
.board-label (data-size="sm", "lg")Plain text: a heading or a label
.board-cardAnything else, usually a Momo card. It fires momo:board-open when opened
.board-cursorSomeone else's pointer with a name flag (decoration; place it with left and top)

Cards with an edit form

A .board-card can hold anything: the example has six kinds, all ordinary Momo cards built from a little data. A card is one thing to grab, so the links and buttons inside it do nothing on the board. Opening it (a double-click, or Enter) fires momo:board-open: show your own dialog, then hand the result back with update(). Keep the card's fields in data-board-data (JSON) and they come along when you save.

const board = Momo.board('#board');

boardEl.addEventListener('momo:board-open', (e) => {
  const task = e.detail.item.data;          // { title, team, who, due }
  fillTheForm(task);
  Momo.dialog.open('#task-dialog');
  currentId = e.detail.id;
});

form.addEventListener('submit', () => {
  const task = readTheForm();
  board.update(currentId, { data: task, html: cardHTML(task) });
});

Saving

The board fires momo:board-change after every change, with everything on it. Send that to your server, or keep it in the browser as the example does. load() puts it back.

boardEl.addEventListener('momo:board-change', (e) => {
  save(e.detail);      // { items: [{ id, type, x, y, w, h, color, text | html, data }] }
});

board.load(await fetchBoard());
board.fit();

Good to know

Reference

Attribute / APIWhat it does
data-momo-board, --board-height, data-board-fitTurns it on, its height (100%), fit everything in view at the start
data-board-tool="…"A tool button: select, hand, note, text, rect, ellipse
data-board-action="…"undo, redo, delete, duplicate, zoom-in, zoom-out, zoom-reset, fit
data-board-color="yellow", data-board-zoom-labelA color swatch, where the zoom percent is written
Momo.board(el)toJSON(), load(data), add(type, opts), update(id, patch), remove(ids), select(ids), tool(name), fit(), zoom(k), view(), undo(), redo()
Event momo:board-changeAfter every change; detail: { items }
Event momo:board-select, momo:board-opendetail: { ids }; detail: { el, id, item }

Start

OverviewStart Getting startedStart CustomizeStart

Guides

AccessibilityGuides BreakpointsGuides ChangelogGuides Customize componentsGuides JavaScriptGuides MotionGuides OptimizeGuides PhonesGuides RebootGuides Right-to-left (RTL)Guides Stacking orderGuides Using Momo with AIGuides

Foundations

ColorsFoundations TypographyFoundations ProseFoundations Images & figuresFoundations CodeFoundations Lines & shadowsFoundations Dark modeFoundations

Forms

Checkbox & switchForms ComboboxForms Date pickerForms Date rangeForms Fields & labelsForms File uploadForms Floating labelsForms Number stepperForms PasswordForms PIN codeForms RatingForms SelectForms SliderForms Tag inputForms Time pickerForms ValidationForms

Components

AccordionComponents Alert & bannerComponents AvatarComponents BadgeComponents BreadcrumbComponents ButtonComponents Button groupComponents CalendarComponents CardComponents CarouselComponents ChartsComponents ChipsComponents CollapseComponents Command paletteComponents CommentsComponents Confirm dialogsComponents Cookie bannerComponents Data tableComponents Description listComponents Dialog & toastComponents DividerComponents DrawerComponents Dropdown menuComponents Empty stateComponents File managerComponents Filter & sortComponents Gallery & lightboxComponents Inbox & chatComponents Infinite scrollComponents KanbanComponents Keyboard shortcutsComponents List groupComponents MarqueeComponents Media objectComponents Nav overflowComponents Notification centerComponents PaginationComponents ProgressComponents Pull to refreshComponents SkeletonComponents SortableComponents SpinnerComponents Split viewComponents Stat cardComponents Steps & wizardComponents Swipe actionsComponents TableComponents TabsComponents TimelineComponents TogglerComponents Tooltip & popoverComponents TourComponents Tree viewComponents VideoComponents WhiteboardComponents

Layout

Announcement barLayout App shellLayout Back to topLayout Container & sectionLayout ExamplesLayout FooterLayout HeroLayout JumbotronLayout Mega menuLayout NavbarLayout Site sidebarLayout

Sections

Bento gridSections Blog cardsSections Call to actionSections Contact & newsletterSections FAQSections FeaturesSections Logo cloudSections PricingSections TeamSections TestimonialsSections

Utilities

OverviewUtilities State variantsUtilities Display & flexUtilities Grid & gapUtilities SpacingUtilities SizingUtilities TextUtilities Links & color strengthUtilities Position & overflowUtilities BackgroundsUtilities Borders & effectsUtilities Transforms & filtersUtilities InteractionsUtilities

Helpers

Fixed, sticky & frostedHelpers Hover & focusHelpers Hover revealHelpers Icon linkHelpers PrintHelpers Relative timeHelpers Screen reader textHelpers Scroll inHelpers ScrollspyHelpers Share buttonHelpers Skip linkHelpers StacksHelpers Stretched linkHelpers Theme toggleHelpers Truncated textHelpers

Page patterns

404 pagePage patterns Coming soonPage patterns Login & registerPage patterns SettingsPage patterns ProfilePage patterns CRM contactsPage patterns ProjectsPage patterns File manager pagePage patterns Billing & plansPage patterns Help centerPage patterns Mobile app screensPage patterns
↑ ↓ moveEnter openEsc close