Skip to main content

7 docs tagged with "dim"

View All Tags

10. Building a Multi-Screen App

Dim does not ship a router package. Production-style demos (Shopping, Messaging) compose useStore, a navigation stack, and transitionId into a multi-screen experience. This tutorial extracts that pattern so you can reuse it.

11. useRef, DOM Access & getRef

useRef holds a mutable value that persists across renders without triggering re-renders when updated. In Dim it also powers cross-component DOM access via getRef.

12. useDimStore: Dim Storage from React

Mixed applications can host Dim web components alongside React trees. The useDimStore hook lets React components read and write the same encrypted IndexedDB keys that Dim’s useStore uses — without mounting a custom element.

6. View Transitions with useViewTransition

Dim includes a view transition system for sliding between UI states. The exported hook is useViewTransition (Storybook may label the section useTransition() — they refer to the same API).

7. Shared-Element Transitions (data-vt-shared)

Slide transitions move entire screens. Shared-element transitions morph a specific element from its old position to its new one using a FLIP (First, Last, Invert, Play) overlay — similar to native mobile navigation.

8. Encrypted Storage & Loading States

The useStore hook persists state to IndexedDB and syncs across components and browser tabs. This guide covers loading tuples and opt-in encryption in the current Dim framework.

9. Props, Attributes & the .props Contract

Dim components receive data from the parent as HTML attributes, the .props property, and light-DOM children. Understanding which channel to use prevents silent bugs and security issues.