Utilização

Build a view wrapper that accepts layout props.

tsx
// Build a view wrapper that accepts layout props.
import { Box, type KuitoNode, type LayoutProps } from 'kuito';

// Only layout passes through: the frame keeps its own look.
function Frame(props: LayoutProps & { children?: KuitoNode }) {
  return <Box borderWidth={1} borderColor="#d1d1d6" borderRadius={8} {...props} />;
}

<Frame width="50%" aspectRatio={1} margin={8} />;

Declaração do tipo

ts
export interface LayoutProps {
  /** Takes the view out of layout and off screen, as CSS `display: none`. */
  hidden?: Prop<boolean>;
  padding?: Prop<LengthPercentage>;
  paddingTop?: Prop<LengthPercentage>;
  paddingRight?: Prop<LengthPercentage>;
  paddingBottom?: Prop<LengthPercentage>;
  paddingLeft?: Prop<LengthPercentage>;
  width?: Animatable<SizeValue>;
  height?: Animatable<SizeValue>;
  minWidth?: Prop<SizeValue>;
  maxWidth?: Prop<SizeValue>;
  minHeight?: Prop<SizeValue>;
  maxHeight?: Prop<SizeValue>;
  /** Width divided by height; sizes the missing side from the other. */
  aspectRatio?: Prop<number>;
  position?: Prop<'relative' | 'absolute'>;
  top?: Prop<LengthPercentageAuto>;
  right?: Prop<LengthPercentageAuto>;
  bottom?: Prop<LengthPercentageAuto>;
  left?: Prop<LengthPercentageAuto>;
  margin?: Prop<LengthPercentageAuto>;
  marginTop?: Prop<LengthPercentageAuto>;
  marginRight?: Prop<LengthPercentageAuto>;
  marginBottom?: Prop<LengthPercentageAuto>;
  marginLeft?: Prop<LengthPercentageAuto>;
  flexGrow?: Prop<number>;
  flexShrink?: Prop<number>;
  flexBasis?: Prop<SizeValue | 'content'>;
  /** A grow factor from a zero basis, as CSS `flex: n`; 0 is inflexible. */
  flex?: Prop<number>;
  alignSelf?: Prop<SelfAlignment | 'auto'>;
  /** The way lines run; unset, the parent's, and the app's first language's at the root. */
  direction?: Prop<'ltr' | 'rtl'>;
  boxSizing?: Prop<'border-box' | 'content-box'>;
  /** Padding on the side lines start from: the left in `ltr`, the right in `rtl`. */
  paddingInlineStart?: Prop<LengthPercentage>;
  /** Padding on the side lines end at: the right in `ltr`, the left in `rtl`. */
  paddingInlineEnd?: Prop<LengthPercentage>;
  /** Margin on the side lines start from: the left in `ltr`, the right in `rtl`. */
  marginInlineStart?: Prop<LengthPercentageAuto>;
  /** Margin on the side lines end at: the right in `ltr`, the left in `rtl`. */
  marginInlineEnd?: Prop<LengthPercentageAuto>;
  /** `left` in `ltr`, `right` in `rtl`. */
  insetInlineStart?: Prop<LengthPercentageAuto>;
  /** `right` in `ltr`, `left` in `rtl`. */
  insetInlineEnd?: Prop<LengthPercentageAuto>;
}

Membros 36

NomeTipoObrigatórioDescrição
hiddenProp<boolean>NãoTakes the view out of layout and off screen, as CSS display: none.
paddingProp<LengthPercentage>Não—
paddingTopProp<LengthPercentage>Não—
paddingRightProp<LengthPercentage>Não—
paddingBottomProp<LengthPercentage>Não—
paddingLeftProp<LengthPercentage>Não—
widthAnimatable<SizeValue>Não—
heightAnimatable<SizeValue>Não—
minWidthProp<SizeValue>Não—
maxWidthProp<SizeValue>Não—
minHeightProp<SizeValue>Não—
maxHeightProp<SizeValue>Não—
aspectRatioProp<number>NãoWidth divided by height; sizes the missing side from the other.
positionProp<"relative" | "absolute">Não—
topProp<LengthPercentageAuto>Não—
rightProp<LengthPercentageAuto>Não—
bottomProp<LengthPercentageAuto>Não—
leftProp<LengthPercentageAuto>Não—
marginProp<LengthPercentageAuto>Não—
marginTopProp<LengthPercentageAuto>Não—
marginRightProp<LengthPercentageAuto>Não—
marginBottomProp<LengthPercentageAuto>Não—
marginLeftProp<LengthPercentageAuto>Não—
flexGrowProp<number>Não—
flexShrinkProp<number>Não—
flexBasisProp<SizeValue | "content">Não—
flexProp<number>NãoA grow factor from a zero basis, as CSS flex: n; 0 is inflexible.
alignSelfProp<"auto" | SelfAlignment>Não—
directionProp<"ltr" | "rtl">NãoThe way lines run; unset, the parent's, and the app's first language's at the root.
boxSizingProp<"border-box" | "content-box">Não—
paddingInlineStartProp<LengthPercentage>NãoPadding on the side lines start from: the left in ltr, the right in rtl.
paddingInlineEndProp<LengthPercentage>NãoPadding on the side lines end at: the right in ltr, the left in rtl.
marginInlineStartProp<LengthPercentageAuto>NãoMargin on the side lines start from: the left in ltr, the right in rtl.
marginInlineEndProp<LengthPercentageAuto>NãoMargin on the side lines end at: the right in ltr, the left in rtl.
insetInlineStartProp<LengthPercentageAuto>Nãoleft in ltr, right in rtl.
insetInlineEndProp<LengthPercentageAuto>Nãoright in ltr, left in rtl.
Gerado a partir das declarações TypeScript públicas: assinaturas, props e predefinições vêm da fonte verificada, as descrições da sua JSDoc. Nenhuma predefinição é inventada.