BlockDex

Components

Registries

Free blocks

Method

BlockDex

Components

Registries

Free blocks

Method

Open API

BlockDex

Components

Registries

Free blocks

Method

Open API

Components/retab-ui/data-cell

Data Cell

retab-ui/data-cell
FreeComponent

A lightweight editable cell for scalar document data: text, numbers, booleans, dates, times, and date-times.

Install it

npx shadcn@latest add https://ui.retab.com/r/data-cell.json

Source

registry/new-york-v4/ui/data-cell.tsxui.retab.com/r/data-cell.json · first 6 KB
1"use client";
2
3import * as React from "react";
4import { flushSync } from "react-dom";
5
6import {
7 useDataCellActivationClickTail,
8 type DataCellActivationSource,
9} from "@/components/ui/data-cell-activation";
10import { DataCellControl } from "@/components/ui/data-cell-control";
11import {
12 createDataCellControlState,
13 getDataCellClickControlAction,
14 getDataCellKeyControlAction,
15 getDataCellPointerControlAction,
16} from "@/components/ui/data-cell-control-actions";
17import type { DataCellControlAction } from "@/components/ui/data-cell-control-contract";
18import { DataCellDisplay } from "@/components/ui/data-cell-display";
19import { createDataCellDisplayProps } from "@/components/ui/data-cell-display-model";
20import { createDataCellEditModel } from "@/components/ui/data-cell-edit-model";
21import type { DataCellProps } from "@/components/ui/data-cell-types";
22
23export type {
24 DataCellCommitValue,
25 DataCellDateTimeZone,
26 DataCellKind,
27 DataCellProps,
28 DataCellSelectOption,
29 DataCellValue,
30 DataCellValueMeta,
31} from "@/components/ui/data-cell-types";
32export {
33 formatDataCellDisplayValue,
34 parseDataCellNumberInput,
35} from "@/components/ui/data-cell-format";
36export { DataCellDisplay };
37
38function storeDataCellActivationSource(
39 sourceRef: React.MutableRefObject<DataCellActivationSource | undefined>,
40 setSource: React.Dispatch<
41 React.SetStateAction<DataCellActivationSource | undefined>
42 >,
43 source: DataCellActivationSource,
44) {
45 // Activation source must be visible to the first active control render so
46 // pointer caret placement and opening-event dismissal see the original event.
47 flushSync(() => {
48 sourceRef.current = source;
49 setSource(source);
50 });
51}
52
53function hasDataCellKeyboardModifier(event: React.KeyboardEvent<HTMLElement>) {
54 const isAltGraph =
55 event.getModifierState("AltGraph") ||
56 event.nativeEvent.getModifierState?.("AltGraph") ||
57 (event.ctrlKey &&
58 event.altKey &&
59 event.key.length === 1 &&
60 !/^[\x00-\x7F]$/.test(event.key));
61 return (
62 event.metaKey ||
63 (event.ctrlKey && !isAltGraph) ||
64 (event.altKey && !isAltGraph) ||
65 event.nativeEvent.isComposing
66 );
67}
68
69export function DataCell(props: DataCellProps) {
70 const {
71 active,
72 editable = false,
73 disabled = false,
74 onActiveChange,
75 onEditingEnd,
76 onClick,
77 onKeyDown,
78 onPointerDown,
79 } = props;
80 const displayRef = React.useRef<HTMLDivElement>(null);
81 const activationClickTail = useDataCellActivationClickTail();
82// … truncated

What it pulls in

npm packages

  • @chenglou/pretext@^0.0.8
  • lucide-react@^0.460.0

Other registry items

  • @retab/calendar
  • @retab/input
  • popover
  • select
  • @retab/utils
  • @retab/use-keyed-layout-effect
  • @retab/use-mount-effect

Files it writes

  • registry/new-york-v4/ui/data-cell.tsx
  • registry/new-york-v4/ui/data-cell-activation.ts
  • registry/new-york-v4/ui/data-cell-boolean-control.tsx
  • registry/new-york-v4/ui/data-cell-boolean-value.ts
  • registry/new-york-v4/ui/data-cell-classes.ts
  • registry/new-york-v4/ui/data-cell-control.tsx
  • registry/new-york-v4/ui/data-cell-control-actions.ts
  • registry/new-york-v4/ui/data-cell-control-contract.ts
  • registry/new-york-v4/ui/data-cell-control-props.ts
  • registry/new-york-v4/ui/data-cell-control-registry.tsx
  • registry/new-york-v4/ui/data-cell-display.tsx
  • registry/new-york-v4/ui/data-cell-display-model.ts
  • registry/new-york-v4/ui/data-cell-edit-model.ts
  • registry/new-york-v4/ui/data-cell-format.ts
  • registry/new-york-v4/ui/data-cell-picker-control.tsx
  • registry/new-york-v4/ui/data-cell-picker-icon.tsx
  • registry/new-york-v4/ui/data-cell-picker-position.ts
  • registry/new-york-v4/ui/data-cell-select-activation.ts
  • registry/new-york-v4/ui/data-cell-select-control.tsx
  • registry/new-york-v4/ui/data-cell-select-keyboard.ts
  • registry/new-york-v4/ui/data-cell-select-navigation.ts
  • registry/new-york-v4/ui/data-cell-select-popup-dismissal.ts
  • registry/new-york-v4/ui/data-cell-select-popup-position.ts
  • registry/new-york-v4/ui/data-cell-select-popup.tsx
  • registry/new-york-v4/ui/data-cell-select-state.ts
  • registry/new-york-v4/ui/data-cell-session.ts
  • registry/new-york-v4/ui/data-cell-input-control.tsx
  • registry/new-york-v4/ui/data-cell-text-activation.ts
  • registry/new-york-v4/ui/data-cell-text-hit-test.ts
  • registry/new-york-v4/ui/data-cell-types.ts

Facts

Registry
retab-ui
Type
registry:ui
Access
Free
Files written
30
Licence
NOASSERTION
First indexed
2026-08-03
Last confirmed
yesterday

Go to the source

ui.retab.com retab-dev/retab-ui on GitHub Raw registry item This item as JSON

More from retab-ui

All 130 items
Same registry, same kind — the ones you would have found next
ComponentRegistryKindAccessInstallsCommand
Alertalertretab-uiComponentsFree1 dep
Alert Dialogalert-dialogretab-uiComponentsFree1 dep
Aspect Ratioaspect-ratioretab-uiComponentsFreeno deps
Attachment Sidebarattachment-sidebarretab-uiComponentsFree1 dep
Autocompleteautocompleteretab-uiComponentsFree2 deps
Calendarcalendarretab-uiComponentsFree2 deps
Code Viewercode-viewerretab-uiComponentsFree2 deps · 32 files
Commandcommandretab-uiComponentsFree2 deps
BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex

BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex

BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex