MCPcopy Index your code
hub / github.com/adobe/react-spectrum / TableRow

Function TableRow

packages/react-aria/stories/table/example.tsx:162–189  ·  view source on GitHub ↗
({
  item,
  children,
  state
}: {
  item: any;
  children: ReactNode;
  state: any;
})

Source from the content-addressed store, hash-verified

160}
161
162export function TableRow({
163 item,
164 children,
165 state
166}: {
167 item: any;
168 children: ReactNode;
169 state: any;
170}): JSX.Element {
171 let ref = useRef<HTMLTableRowElement | null>(null);
172 let isSelected = state.selectionManager.isSelected(item.key);
173 let {rowProps} = useTableRow({node: item}, state, ref);
174 let {isFocusVisible, focusProps} = useFocusRing();
175
176 return (
177 <tr
178 style={{
179 // eslint-disable-next-line no-nested-ternary
180 background: isSelected ? 'blueviolet' : item.index % 2 ? 'lightgray' : 'none',
181 color: isSelected ? 'white' : undefined,
182 outline: isFocusVisible ? '2px solid orange' : 'none'
183 }}
184 {...mergeProps(rowProps, focusProps)}
185 ref={ref}>
186 {children}
187 </tr>
188 );
189}
190
191export function TableCell({cell, state}: {cell: any; state: any}): JSX.Element {
192 let ref = useRef<HTMLTableCellElement | null>(null);

Callers

nothing calls this directly

Calls 4

useTableRowFunction · 0.90
useFocusRingFunction · 0.90
mergePropsFunction · 0.90
isSelectedMethod · 0.65

Tested by

no test coverage detected