MCPcopy Create free account
hub / github.com/adobe/react-spectrum / useSkeletonText

Function useSkeletonText

packages/@react-spectrum/s2/src/Skeleton.tsx:100–115  ·  view source on GitHub ↗
(
  children: ReactNode,
  style: CSSProperties | undefined
)

Source from the content-addressed store, hash-verified

98); // add to a separate layer so it overrides default style macro styles
99
100export function useSkeletonText(
101 children: ReactNode,
102 style: CSSProperties | undefined
103): [ReactNode, CSSProperties | undefined] {
104 let isSkeleton = useContext(SkeletonContext);
105 if (isSkeleton) {
106 children = <SkeletonText>{children}</SkeletonText>;
107 style = {
108 ...style,
109 // This ensures the ellipsis on truncated text is also hidden.
110 // -webkit-text-fill-color overrides any `color` property that is also set.
111 WebkitTextFillColor: 'transparent'
112 };
113 }
114 return [children, style];
115}
116
117// Rendered inside <Text> to create skeleton line boxes via box-decoration-break.
118export function SkeletonText({children}: {children: ReactNode}): ReactNode {

Callers 2

Link.tsxFile · 0.90
Content.tsxFile · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected