Components/BaseSurface
Since 2.5.0BETA

BaseSurface

Unified background rendering component supporting pure/mask/blur/glass/refraction modes with motion-degradation fallback for backdrop-filter + transform issues.

This page was migrated by AI, please review carefully

Migration is complete, but please validate against source code and manual review.

BaseSurface

Unified background rendering component — supports pure, mask, blur, glass, and refraction modes, with a built-in motion degradation mechanism that automatically resolves the well-known Chromium backdrop-filter + transform invalidation bug.

Supports fake pseudo-element rendering mode (consistent with the existing .fake-background utility). Dark mode switches automatically via the CSS variable system.

Relationship with TxCard

  • Use TxCard for out-of-the-box product usage (header/footer/loading/inertial/interaction states).
  • Use TxBaseSurface for low-level material tuning (filter/refraction/glass parameter matrix).
  • Recommended split: TxCard handles container semantics + interaction, TxBaseSurface handles material rendering.

Background Modes

Five modes compared: pure solid color, mask semi-transparent overlay, blur backdrop blur, glass glass layer, and refraction glass+filter refraction.

Mode Comparison

Demo loads on client.

Advanced Parameter Lab

Use this low-level lab to tune material parameters in filter / refraction workflows. For product-facing card usage, TxCard is still the recommended first choice.

Advanced Lab

Demo loads on client.

Fake Pseudo-Element Mode

Enable pseudo-element background rendering via the fake prop. Slot content naturally sits above the background without extra z-index management. Useful when you need consistency with the existing .fake-background pattern.

Fake Mode

Demo loads on client.

Motion Fallback

When blur or glass mode elements are in a CSS transform animation, backdrop-filter becomes invalidated (known Chromium bug).

Use the moving prop for manual control, or auto-detect for automatic transform detection. The component degrades to fallbackMode (default mask) during motion and smoothly recovers afterward.

Click the button to trigger real transform movement on both blur and glass cards. The cards contain scrollable content inside.

Multi-Mode Motion Fallback

Demo loads on client.

Raw vs BaseSurface Comparison

Left side uses raw backdrop-filter — blur breaks completely during transform motion. Right side uses BaseSurface — gracefully degrades to mask during motion, then smoothly recovers to glass when stopped.

Motion Comparison

Demo loads on client.

API

TxBaseSurface Props

PropTypeDefaultDescription
mode'pure' | 'mask' | 'blur' | 'glass' | 'refraction''pure'Surface mode: pure / mask / filter / glass / refraction.
radiusstring | number-Custom border radius (inherits from parent if unset).
colorstring-Base color for pure/mask layers.
opacitynumber0.75Opacity in mask mode (0-1).
fallbackMaskOpacitynumber-Overrides opacity when degraded to mask (0-1).
blurnumber10Blur intensity for the filter layer (px).
filterSaturationnumber1.5Filter-layer saturation (low-level tuning).
filterContrastnumber1Filter-layer contrast (low-level tuning).
filterBrightnessnumber1Filter-layer brightness (low-level tuning).
saturationnumber1.8Glass-layer saturation for glass/refraction.
brightnessnumber70Glass-layer brightness for glass/refraction.
backgroundOpacitynumber0Background opacity of the glass layer.
borderWidthnumber0.07Edge width factor for the glass layer.
displacenumber0.5Refraction displacement amount.
distortionScalenumber-180Refraction distortion scale.
redOffset / greenOffset / blueOffsetnumber0 / 10 / 20RGB channel offsets for spectral separation.
xChannel / yChannel'R' | 'G' | 'B''R' / 'G'Sampling channels used by displacement maps.
mixBlendModestring'difference'Blend mode used in refraction rendering.
refractionStrengthnumber-Unified refraction strength (0-100).
refractionProfile'soft' | 'filmic' | 'cinematic'-Refraction style preset.
refractionTone'mist' | 'balanced' | 'vivid''balanced'Refraction tone preset (vivid is clearer, mist is softer).
refractionAnglenumber-Main dispersion angle in degrees.
refractionLightX / refractionLightYnumber-Light anchor coordinates (0-1).
refractionHaloOpacitynumber-Halo opacity override (0-1). If unset, uses the internal filmic model.
overlayOpacitynumber0Optional extra mask opacity for non-mask modes.
preset'default' | 'card''default'Visual preset (card applies card-focused tuning).
refractionRenderer'svg' | 'css''svg'Renderer type for refraction mode.
movingbooleanfalseManual motion flag for degradation fallback.
fallbackMode'pure' | 'mask''mask'Target mode while moving.
settleDelaynumber150Delay before recovery after motion ends (ms).
autoDetectbooleanfalseAuto detect transform motion and fallback.
transitionDurationnumber260Recovery transition duration (ms).
fakebooleanfalseEnable fake pseudo-element rendering mode.
fakeIndexnumber0z-index for fake layer.
tagstring'div'Root element tag name.

Slots

SlotDescription
defaultSurface content.

CSS Variables

VariableDescriptionLight DefaultDark Default
--tx-surface-colorSolid/mask background colorvar(--tx-fill-color-lighter) (#fafafa)#1d1d1d
--tx-surface-blur-bgSemi-transparent base for blur/glassrgba(255,255,255,0.6)rgba(0,0,0,0.4)
Was this helpful?