Skip to content

hd-model

Attributes and example

hd-model

One model of your library on its own, filling its box: a piece of Tiledash’s furniture, one of your own models or one you installed from the Community. In 2.5D from a fixed angle, or in 3D turned any way round (from below, upside down, rolled) by a camera set in the tile’s settings. With a device, a lamp’s shade lights up in the light’s colour while it is on and any other model glows softly around itself. rotate lets people turn it on the dashboard; a drag never counts as a tap. One renderer draws every model on the page; Paper and screens without WebGL 2 show its top view. Says so when no model is picked, it is loading, it couldn’t be loaded or it is gone. Parts: ::part(notice).

AttributeWhat it is
appearanceJSON appearance overrides by group id, e.g. {{ settings.model.appearanceAttr | escape }}. Choices belong only to this copy.
modelrequiredThe model, e.g. {{ settings.model.attr }} (a model setting): kit:<piece> or model:<id>.
view25d from a fixed angle above (angle, turn); 3d turned by camera.One of 25d, 3d. Default 25d.
angleIn 25d, the angle it is seen from: isometric (35°), game (30°, the 2:1 look of pixel-art games) or steep (50°).One of isometric, game, steep. Default isometric.
turnIn 25d, turns the model clockwise, in degrees.One of 0, 90, 180, 270. Default 0.
cameraIn 3d, how the model is turned and zoomed, e.g. {{ settings.camera.attr }} (a model camera setting): "<x> <y> <z> <w> <zoom>". The isometric view without one.
rotateIn 3d, lets people turn it on the dashboard: one finger (the tile then doesn’t scroll the page) or two fingers (one finger still scrolls); a mouse drags either way. A turn stays until the page draws it afresh; nothing is saved.One of off, one, two. Default off.
deviceA device whose light it shows, e.g. {{ settings.device.id }}: on, a lamp’s shade lights up in the light’s colour, anything else glows.
nameThe model’s name, e.g. {{ settings.model.name }}: for screen readers, and what a gone model’s notice names.
lightHow it is lit: bright all round, soft (the floor plan’s even light) or studio (a key, a fill and a rim light, for shape).One of bright, soft, studio. Default bright.
colourstheme draws it in the theme’s tones; own in its own colours and textures.One of theme, own. Default theme.
<hd-model model="{{ settings.model.attr }}" name="{{ settings.model.name }}" view="3d" camera="{{ settings.camera.attr }}" device="{{ settings.device.id }}" data-hd-tap="tileTap"></hd-model>

Styling

Set CSS variables on the component element. Its internal elements live in Shadow DOM; only the exposed named parts can be styled with ::part.

--hd-accent
The theme’s accent: active controls, links, highlights.
--hd-appearance
`light`, `dark` or `paper`, for what colours alone can’t decide.
--hd-border-width
How thick borders are.
--hd-focus
The outline round what has keyboard focus.
--hd-font-ui
The font of labels and running text.
--hd-radius-sm
Small corners: chips, small buttons.
--hd-surface
A tile’s colour.
--hd-text
Text and big numbers.
--hd-text-2xs
CSS input read by hd-model.
--hd-text-faint
The quietest text: hints, units, times.
--hd-text-muted
Labels and secondary text.
--hd-text-sm
CSS input read by hd-model.
--hd-text-xs
CSS input read by hd-model.

Exposed parts

hd-model::part(notice) {  /* Your styles */}

Style the host

hd-model {  --hd-accent: #2563eb;  max-width: 100%;}
Theme variables