JSFiddle - React, Tailwind, and code Playground

CSS

body {
	  margin: 0;
}

JavaScript

import * as THREE from 'https://cdn.skypack.dev/three@0.128.0/build/three.module.js';
import { OrbitControls } from 'https://cdn.skypack.dev/three@0.128.0/examples/jsm/controls/OrbitControls.js';

let camera, scene, renderer;
init();
animate();

function init() {

    renderer = new THREE.WebGLRenderer( { antialias: true } );
    renderer.setSize( window.innerWidth, window.innerHeight );
    renderer.localClippingEnabled = true;

    camera = new THREE.PerspectiveCamera( 70, window.innerWidth / window.innerHeight, 0.01, 10 );
    camera.rotation.y = Math.PI * 0.2;
    camera.position.z = 1;
    camera.position.x = 2;
    camera.position.y = 1;

    scene = new THREE.Scene();
    scene.background = new THREE.Color( 0xffffff );
    
    var localPlane = new THREE.Plane( new THREE.Vector3( 0, 0, -1 ), 0.1 );

    const geometry = new THREE.BoxGeometry( 0.4, 0.4, 0.4 );
    const material = new THREE.MeshLambertMaterial({
    	color: "#ff0000",
      clippingPlanes: [ localPlane ],
    	clipShadows: true
    });
    material.onBeforeCompile = function( shader ) {
        shader.fragmentShader = shader.fragmentShader.replace(
            `#include <output_fragment>`,
            `#ifdef OPAQUE
             diffuseColor.a = 1.0;
             #endif
             // https://github.com/mrdoob/three.js/pull/22425
             #ifdef USE_TRANSMISSION
             diffuseColor.a *= material.transmissionAlpha + 0.1;
             #endif
             gl_FragColor = ( gl_FrontFacing ) ? vec4( outgoingLight, diffuseColor.a ) : vec4( diffuse * vec3(0.61, 0.41, 0.06), 1. );
            `
        );
    };
    const mesh = new THREE.Mesh( geometry, material );
    scene.add( mesh );
    
    const geometry1 = new THREE.BoxGeometry( 0.2, 0.2, 0.2 );
    const material1 = new THREE.MeshLambertMaterial({
    	color: "#0000ff",
      //clippingPlanes: [ localPlane ],
    	clipShadows: true
    });
    const mesh1 = new THREE.Mesh( geometry1, material1 );
    scene.add( mesh1 );
    
   ...