Skip to content

Conversation

@marklundin
Copy link
Collaborator

@marklundin marklundin commented May 2, 2025

3D Component Blocks

This PR adds a new feature called Component Blocks - a set of high level 3d react primitives. The components are themed, composable and responsive following modern component design principles.

Each component can be installed using shadcn using a custom registry hosted on playcanvas-react.vercel.app

SplatViewer

A new composable and theme-able <SplatViewer/> block for rendering gaussian splats

pc-react-blocks.mp4

Usage

import { SplatViewer } from '@components/ui/splat-viewer';
import './viewer.css';

 export function SplatViewerDemo() {
   return (
     <SplatViewer className="splat-viewer" src='./skull.ply'>
       <FullScreenButton />
       <DownloadButton />
       <MenuButton />
     </SplatViewer>
  )
}

Composable & Theme-able

The SplatViewer block is composable - providing a consistent UX with customisable controls and layout. It aims to align with existing media players such as the <video /> element - supporting props such as poster for placeholder content, but with a more flexible approach to the layout of controls - controls can be omitted or re-ordered.

The block can also easily be styled and react to the system light/dark theme.

Tasks

  • Core <SplatViewer /> Block
  • Support poster for loading states
  • Support Full Screen
  • Support Download
  • Context Menu
  • Add custom shadcn registry

marklundin added 2 commits May 2, 2025 14:01
- Added new Radix UI components including Badge, Button, ContextMenu, DropdownMenu, and Tooltip to enhance the UI.
- Introduced a SplatViewer component for displaying Gaussian splats with built-in camera controls and UI slots.
- Updated package.json and package-lock.json to include new dependencies for Radix UI and related libraries.
- Created a new components.json file to define component structure and aliases for better organization.
- Enhanced global styles in globals.css to support new components and improve overall design consistency.
- Updated documentation to include new blocks and examples for the SplatViewer component.

These changes improve the UI capabilities and documentation clarity, providing a better developer experience.
…json; update global styles in globals.css to streamline codebase and improve design consistency.
@pkg-pr-new
Copy link

pkg-pr-new bot commented May 2, 2025

Open in StackBlitz

npm i https://pkg.pr.new/playcanvas/react/@playcanvas/react@122

commit: ee13ccd

@marklundin marklundin changed the title Feat blocks Add Component blocks May 2, 2025
@marklundin marklundin changed the title Add Component blocks Add Component Blocks May 2, 2025
marklundin added 6 commits May 2, 2025 17:06
…ponent

- Included @testing-library/dom version 10.4.0 in package.json and package-lock.json for enhanced testing capabilities.
- Updated MenuButton component to improve UI structure by repositioning the DropdownMenuLabel and DropdownMenuSeparator for better accessibility.
- Revised documentation for Splat Viewer component to clarify its functionality and responsiveness.
- Added a new Slider component for timeline control in the Splat Viewer.
- Integrated animation capabilities by introducing a Timeline component and associated animation utilities.
- Updated package.json and package-lock.json to include new dependencies for Radix UI components.
- Enhanced the Splat Viewer to support animation tracks, improving user interaction and experience.
- Revised documentation to reflect the new features and usage examples for the Splat Viewer and Timeline components.
- Introduced a new SplatViewer component with animation capabilities, including a timeline for controlling playback.
- Added utility components such as DownloadButton, FullScreenButton, and MenuButton to enhance user interaction.
- Updated package.json and package-lock.json to include new dependencies for animation and UI components.
- Revised documentation to reflect the new features, including usage examples and improved clarity in the _meta.tsx file.
- Adjusted global styles in globals.css to support the new components and improve design consistency.
- Simplified the update method in AnimCamera by removing the cursor update line, streamlining the animation logic.
- Cleaned up imports in pose.ts by removing an unused import, enhancing code clarity and maintainability.
@marklundin marklundin merged commit 8089bc7 into main May 9, 2025
5 checks passed
@marklundin marklundin deleted the feat-blocks branch May 9, 2025 12:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants