Components

Inspector

Inspector presents supplemental controls or contextual details beside primary content.

Example

Requires React 18.2+ or 19 and shared styles. See setup.

Default

Loading preview…

Code
'use client';
import { useState } from 'react';
import { Button, Text, VStack } from '@swiftuijs/ui';
import { Inspector, type IInspectorProps } from '@swiftuijs/ui';
function Demo(props: Partial<IInspectorProps>) {
    const [isPresented, setIsPresented] = useState(true);
    return (<VStack spacing={12}>
      <Button onClick={() => setIsPresented((value) => !value)}>
        {isPresented ? 'Hide inspector' : 'Show inspector'}
      </Button>
      <Inspector content={<VStack spacing={8}>
            <Text>Selection details</Text>
            <Text>Properties</Text>
            <Text>Actions</Text>
          </VStack>} isPresented={isPresented} onOpenChange={setIsPresented} style={{ minHeight: '280px' }} title="Inspector" {...props}>
        <VStack spacing={8}>
          <Text>Main document content</Text>
          <Text>Inspector is useful for secondary controls and metadata.</Text>
        </VStack>
      </Inspector>
    </VStack>);
}
export default function Example() {
    return (<Demo />);
}

Usage and limitations

  • Use isPresented and onOpenChange to control visibility from React state
  • Use content for the secondary inspection panel
  • Use placement="leading" when the inspector should appear before primary content

More examples

Leading Placement

API reference

PropTypeRequiredDescription
isPresentedbooleanYesWhether the inspector is visible.
onOpenChange(isPresented: boolean) => voidNoCalled when the visibility should change.
contentReactNodeYesInspector content rendered in the side panel.
placement'leading' | 'trailing'NoPlacement of the inspector relative to the main content. Default: 'trailing'
widthnumber | stringNoPanel width. Default: 320
titlestringNoAccessible title for the inspector region.
dismissLabelstringNoDismiss button label. Default: 'Hide inspector'

Inherits additional props from IBaseComponent.