Skip to content
Components
app-studio

Center

A layout component that centers its children both horizontally and vertically within its bounds using CSS Flexbox. Perfect for creating loading states, empty states, modal content, hero sections, and any content that needs perfect centering.

View component source

Import

ts
import { Center } from 'app-studio';

New to the library? Complete installation and provider setup first.

Interactive examples

Try the component, then open Code to copy the complete example.

INTERACTIVE EXAMPLE

Loading preview…

Props

Required props are marked below. A dash indicates an unspecified default. Design system configuration can override implementation defaults.

Scroll horizontally to see every column.

Center
PropTypeDefaultDescription
srcstring—Source URL of the media.
altstring—See the type and source declaration for this property.
controlsboolean—See the type and source declaration for this property.
mutedboolean—See the type and source declaration for this property.
autoPlayboolean—See the type and source declaration for this property.
loopboolean—See the type and source declaration for this property.
posterstring—See the type and source declaration for this property.
playsInlineboolean—See the type and source declaration for this property.
preload"" | "metadata" | "auto" | "none"
"""metadata""auto""none"
—See the type and source declaration for this property.
crossOrigin"" | "anonymous" | "use-credentials"
"""anonymous""use-credentials"
—See the type and source declaration for this property.
srcSetstring—See the type and source declaration for this property.
sizesstring—See the type and source declaration for this property.
loading"eager" | "lazy"
"eager""lazy"
—See the type and source declaration for this property.
referrerPolicyreact.HTMLAttributeReferrerPolicy
"""no-referrer""no-referrer-when-downgrade""origin""origin-when-cross-origin""same-origin""strict-origin""strict-origin-when-cross-origin""unsafe-url"
—See the type and source declaration for this property.
decoding"auto" | "async" | "sync"
"auto""async""sync"
—See the type and source declaration for this property.
namestring—Field name used by forms and Formik bindings.
valuestring | number | readonly string[]—Current controlled value. Update it from the matching change callback.
defaultValuestring | number | readonly string[]—Initial value for uncontrolled usage.
multipleboolean—See the type and source declaration for this property.
disabledboolean—Disables user interaction.
readOnlyboolean—See the type and source declaration for this property.
requiredboolean—See the type and source declaration for this property.
autoCompletestring—See the type and source declaration for this property.
autoFocusboolean—See the type and source declaration for this property.
placeholderstring—Hint displayed while the field is empty.
patternstring—See the type and source declaration for this property.
minstring | number—Minimum allowed value.
maxstring | number—Maximum allowed value.
minLengthnumber—Minimum permitted input length.
maxLengthnumber—Maximum permitted input length.
stepstring | number—Increment between allowed values.
formstring—See the type and source declaration for this property.
formActionstring—See the type and source declaration for this property.
formEncTypestring—See the type and source declaration for this property.
formMethod"dialog" | "get" | "post"
"dialog""get""post"
—See the type and source declaration for this property.
formNoValidateboolean—See the type and source declaration for this property.
formTargetstring—See the type and source declaration for this property.
rowsnumber—See the type and source declaration for this property.
colsnumber—See the type and source declaration for this property.
wrapstring—HTML textarea wrap attribute. Browsers accept 'hard' | 'soft' | 'off' but the DOM type widens to plain `string`, so we mirror that here.
liststring—See the type and source declaration for this property.
acceptstring—See the type and source declaration for this property.
captureboolean | "user" | "environment"—See the type and source declaration for this property.
colSpannumber—See the type and source declaration for this property.
rowSpannumber—See the type and source declaration for this property.
headersstring—See the type and source declaration for this property.
scopestring—See the type and source declaration for this property.
hrefstring—See the type and source declaration for this property.
targetstring—See the type and source declaration for this property.
relstring—See the type and source declaration for this property.
hrefLangstring—See the type and source declaration for this property.
downloadstring | boolean—See the type and source declaration for this property.
xmlnsstring—See the type and source declaration for this property.
viewBoxstring—See the type and source declaration for this property.
preserveAspectRatiostring—See the type and source declaration for this property.
openboolean—See the type and source declaration for this property.
scopedboolean—See the type and source declaration for this property.
reversedboolean—See the type and source declaration for this property.
startnumber—See the type and source declaration for this property.
htmlForstring—See the type and source declaration for this property.
onRecord<string, CssProps>—See the type and source declaration for this property.
mediaRecord<string, CssProps>—See the type and source declaration for this property.
onlystring[]—See the type and source declaration for this property.
cssany—See the type and source declaration for this property.
onPressany—See the type and source declaration for this property.
onClickany—Called when the user activates the component.
classNamestring—See the type and source declaration for this property.
blendboolean—See the type and source declaration for this property.
typestring—See the type and source declaration for this property.
askeyof JSX.IntrinsicElements
"symbol""object""slot""style""title""pattern""form""animate""clipPath""filter""marker""mask""a""abbr""address""area""article""aside""audio""b""base""bdi""bdo""big""blockquote""body""br""button""canvas""caption""center""cite""code""col""colgroup""data""datalist""dd""del""details""dfn""dialog""div""dl""dt""em""embed""fieldset""figcaption""figure""footer""h1""h2""h3""h4""h5""h6""head""header""hgroup""hr""html""i""iframe""img""input""ins""kbd""keygen""label""legend""li""link""main""map""mark""menu""menuitem""meta""meter""nav""noindex""noscript""ol""optgroup""option""output""p""param""picture""pre""progress""q""rp""rt""ruby""s""samp""search""script""section""select""small""source""span""strong""sub""summary""sup""table""template""tbody""td""textarea""tfoot""th""thead""time""tr""track""u""ul""var""video""wbr""webview""svg""animateMotion""animateTransform""circle""defs""desc""ellipse""feBlend""feColorMatrix""feComponentTransfer""feComposite""feConvolveMatrix""feDiffuseLighting""feDisplacementMap""feDistantLight""feDropShadow""feFlood""feFuncA""feFuncB""feFuncG""feFuncR""feGaussianBlur""feImage""feMerge""feMergeNode""feMorphology""feOffset""fePointLight""feSpecularLighting""feSpotLight""feTile""feTurbulence""foreignObject""g""image""line""linearGradient""metadata""mpath""path""polygon""polyline""radialGradient""rect""set""stop""switch""text""textPath""tspan""use""view"
—See the type and source declaration for this property.
stylereact.CSSProperties—See the type and source declaration for this property.
widthHeightstring | number—See the type and source declaration for this property.
children
View typestring | number | bigint | boolean | react.ReactElement<unknown, string | react.JSXElementConstructor<any>> | Iterable<react.ReactNode> | react.ReactPortal | Promise<string | number | bigint | boolean | react.ReactPortal | react.ReactElement<unknown, string | react.JSXElementConstructor<any>> | Iterable<react.ReactNode> | null | undefined> | null
—Content rendered inside the component.
srcDocstring—See the type and source declaration for this property.
sandboxstring—See the type and source declaration for this property.
tostring—Destination URL or application route.
keysany[]—See the type and source declaration for this property.
sxany—See the type and source declaration for this property.
itemStyleany—See the type and source declaration for this property.
paddingXstring | number—See the type and source declaration for this property.
paddingYstring | number—See the type and source declaration for this property.
marginXstring | number—See the type and source declaration for this property.
marginYstring | number—See the type and source declaration for this property.
hoverBackgroundColorstring—See the type and source declaration for this property.
hoverboolean | Record<string, any>—See the type and source declaration for this property.
hoverStyleRecord<string, any>—See the type and source declaration for this property.
checkedboolean—See the type and source declaration for this property.
defaultCheckedboolean—See the type and source declaration for this property.
transitionstring—This feature is well established and works across many devices and browser versions. It’s been available across browsers since September 2015. **Syntax**: `<single-transition>#` | Chrome | Firefox | Safari | Edge | IE | | :-----: | :-----: | :-------: | :----: | :----: | | **26** | **16** | **9** | **12** | **10** | | 1 _-x-_ | | 3.1 _-x-_ | | |
before
View typestring | number | bigint | boolean | react.ReactElement<unknown, string | react.JSXElementConstructor<any>> | Iterable<react.ReactNode> | react.ReactPortal | Promise<string | number | bigint | boolean | react.ReactPortal | react.ReactElement<unknown, string | react.JSXElementConstructor<any>> | Iterable<react.ReactNode> | null | undefined> | null
—See the type and source declaration for this property.
after
View typestring | number | bigint | boolean | react.ReactElement<unknown, string | react.JSXElementConstructor<any>> | Iterable<react.ReactNode> | react.ReactPortal | Promise<string | number | bigint | boolean | react.ReactPortal | react.ReactElement<unknown, string | react.JSXElementConstructor<any>> | Iterable<react.ReactNode> | null | undefined> | null
—See the type and source declaration for this property.
themePartial<Theme>—Component-scoped theme override. Remaps `theme-*` tokens used by this component (and its style props) to different color tokens, without affecting the global ThemeProvider. Each value is a color token string (`color-red-500`, `theme-secondary`) or a raw color (`#ff0000`).
themeMode"light" | "dark"
"light""dark"
—See the type and source declaration for this property.
animateOn"View" | "Mount" | "Both" | "Scroll"
"View""Mount""Both""Scroll"
—See the type and source declaration for this property.
_hoverstring | CssProps—See the type and source declaration for this property.
_activestring | CssProps—See the type and source declaration for this property.
_focusstring | CssProps—See the type and source declaration for this property.
_visitedstring | CssProps—See the type and source declaration for this property.
_disabledstring | CssProps—See the type and source declaration for this property.
_enabledstring | CssProps—See the type and source declaration for this property.
_checkedstring | CssProps—See the type and source declaration for this property.
_uncheckedstring | CssProps—See the type and source declaration for this property.
_invalidstring | CssProps—See the type and source declaration for this property.
_validstring | CssProps—See the type and source declaration for this property.
_requiredstring | CssProps—See the type and source declaration for this property.
_optionalstring | CssProps—See the type and source declaration for this property.
_selectedstring | CssProps—See the type and source declaration for this property.
_targetstring | CssProps—See the type and source declaration for this property.
_firstChildstring | CssProps—See the type and source declaration for this property.
_lastChildstring | CssProps—See the type and source declaration for this property.
_onlyChildstring | CssProps—See the type and source declaration for this property.
_firstOfTypestring | CssProps—See the type and source declaration for this property.
_lastOfTypestring | CssProps—See the type and source declaration for this property.
_emptystring | CssProps—See the type and source declaration for this property.
_focusVisiblestring | CssProps—See the type and source declaration for this property.
_focusWithinstring | CssProps—See the type and source declaration for this property.
_placeholderstring | CssProps—See the type and source declaration for this property.
_oddstring | CssProps—See the type and source declaration for this property.
_evenstring | CssProps—See the type and source declaration for this property.
_groupHoverstring | CssProps—See the type and source declaration for this property.
_groupFocusstring | CssProps—See the type and source declaration for this property.
_groupActivestring | CssProps—See the type and source declaration for this property.
_groupDisabledstring | CssProps—See the type and source declaration for this property.
_peerHoverstring | CssProps—See the type and source declaration for this property.
_peerFocusstring | CssProps—See the type and source declaration for this property.
_peerActivestring | CssProps—See the type and source declaration for this property.
_peerDisabledstring | CssProps—See the type and source declaration for this property.
_peerCheckedstring | CssProps—See the type and source declaration for this property.
_beforeCssProps—See the type and source declaration for this property.
_afterCssProps—See the type and source declaration for this property.
_firstLetterCssProps—See the type and source declaration for this property.
_firstLineCssProps—See the type and source declaration for this property.
_selectionCssProps—See the type and source declaration for this property.
_backdropCssProps—See the type and source declaration for this property.
_markerCssProps—See the type and source declaration for this property.
_webkitAutofillstring | CssProps—See the type and source declaration for this property.
_webkitContactsAutoFillButtonstring | CssProps—See the type and source declaration for this property.
_webkitInnerSpinButtonstring | CssProps—See the type and source declaration for this property.
_webkitOuterSpinButtonstring | CssProps—See the type and source declaration for this property.
_webkitSearchCancelButtonstring | CssProps—See the type and source declaration for this property.
_mozPlaceholderstring | CssProps—See the type and source declaration for this property.
_mozFocusInnerstring | CssProps—See the type and source declaration for this property.
paddingHorizontalstring | number—See the type and source declaration for this property.
marginHorizontalstring | number—See the type and source declaration for this property.
paddingVerticalstring | number—See the type and source declaration for this property.
marginVerticalstring | number—See the type and source declaration for this property.
animateAnimationProps | AnimationProps[]—See the type and source declaration for this property.
animateInAnimationProps | AnimationProps[]—See the type and source declaration for this property.
animateOutAnimationProps | AnimationProps[]—See the type and source declaration for this property.
shadownumber | boolean | Shadow—Shadow or elevation styling.
WebkitUserDragimport("/Volumes/workspace/open-source/app-studio-components/node_modules/csstype/index").Property.UserSelect
"all""text""auto""none""-moz-initial""inherit""initial""revert""revert-layer""unset""-moz-none"
—See the type and source declaration for this property.
webkitUserDragimport("/Volumes/workspace/open-source/app-studio-components/node_modules/csstype/index").Property.UserSelect
"all""text""auto""none""-moz-initial""inherit""initial""revert""revert-layer""unset""-moz-none"
—See the type and source declaration for this property.
safeAreaboolean | "all" | SafeAreaEdge | SafeAreaEdge[]—`true`/`'all'` = all four edges; or a single edge / array of edges.
safeAreaTopboolean—Per-edge opt-in. An explicit boolean wins over `safeArea`/`safeAreaEdges`.
safeAreaBottomboolean—See the type and source declaration for this property.
safeAreaLeftboolean—See the type and source declaration for this property.
safeAreaRightboolean—See the type and source declaration for this property.
safeAreaEdgesSafeAreaEdge[]—Explicit edge list, merged with `safeArea`.
ignoreSafeAreaboolean—Force safe area OFF — wins over every other safe-area prop.
safeAreaModeSafeAreaMode
"margin""padding"
—Apply the inset as padding (default) or margin.
accessibilityLabelstring | null—See the type and source declaration for this property.
accessibilityLiveRegion"none" | "polite" | "assertive"
"none""polite""assertive"
—See the type and source declaration for this property.
accessibilityRolestring | null—See the type and source declaration for this property.
accessibilityState
View type{ busy?: boolean | null | undefined; checked?: (boolean | null | undefined) | "mixed"; disabled?: boolean | null | undefined; expanded?: boolean | null | undefined; grabbed?: boolean | null | undefined; hidden?: boolean | null | undefined; invalid?: boolean | null | undefined; modal?: boolean | null | undefined; pressed?: boolean | null | undefined; readonly?: boolean | null | undefined; required?: boolean | null | undefined; selected?: boolean | null | undefined; }
—See the type and source declaration for this property.
accessibilityValue{ max?: number | null | undefined; min?: number | null | undefined; now?: number | null | undefined; text?: string | null | undefined; }—See the type and source declaration for this property.
accessibleboolean—See the type and source declaration for this property.
importantForAccessibility"auto" | "yes" | "no" | "no-hide-descendants"
"auto""yes""no""no-hide-descendants"
—See the type and source declaration for this property.
nativeIDstring | null—See the type and source declaration for this property.
onLayout((e: LayoutEvent) => void)—See the type and source declaration for this property.
onMoveShouldSetResponder((e: any) => boolean)—See the type and source declaration for this property.
onMoveShouldSetResponderCapture((e: any) => boolean)—See the type and source declaration for this property.
onResponderEnd((e: any) => void)—See the type and source declaration for this property.
onResponderGrant((e: any) => void)—See the type and source declaration for this property.
onResponderMove((e: any) => void)—See the type and source declaration for this property.
onResponderReject((e: any) => void)—See the type and source declaration for this property.
onResponderRelease((e: any) => void)—See the type and source declaration for this property.
onResponderStart((e: any) => void)—See the type and source declaration for this property.
onResponderTerminate((e: any) => void)—See the type and source declaration for this property.
onResponderTerminationRequest((e: any) => boolean)—See the type and source declaration for this property.
onScrollShouldSetResponder((e: any) => boolean)—See the type and source declaration for this property.
onScrollShouldSetResponderCapture((e: any) => boolean)—See the type and source declaration for this property.
onSelectionChangeShouldSetResponder((e: any) => boolean)—See the type and source declaration for this property.
onSelectionChangeShouldSetResponderCapture((e: any) => boolean)—See the type and source declaration for this property.
onStartShouldSetResponder((e: any) => boolean)—See the type and source declaration for this property.
onStartShouldSetResponderCapture((e: any) => boolean)—See the type and source declaration for this property.
testIDstring | null—See the type and source declaration for this property.
dataSetObject | null—See the type and source declaration for this property.

For shared layout, color, and responsive properties, read Styling & composition and Responsive layouts. Additional native element attributes depend on the target platform.

Usage guidance

  • Give controls a visible label or an accessible name, and verify keyboard interaction. See Accessibility.
  • For controlled inputs, update the value from the callback shown in the props table. Keep application state in your component or form library.
  • These previews run in the browser. Check React Native setup for platform requirements and differences.
Browse documentation source