Centre
Centre centers its child both horizontally and vertically within available space using flexbox.

Tsx

import { Centre } from '@dynshift/layr';

Tsx

Preview

NOTE: Previews are not depiction of actual website output.
1. Basic Usage
1a. Simple Centering
Center any content:

Tsx

Preview

NOTE: Previews are not depiction of actual website output.
1b. Full Screen Center
Expand to fill parent:

Tsx

Preview

NOTE: Previews are not depiction of actual website output.
1c. Card Center

Tsx

Preview

NOTE: Previews are not depiction of actual website output.
2. Size Factors
2a. Width Factor
Centre width = child width × widthFactor:

Tsx

Preview

NOTE: Previews are not depiction of actual website output.
2b. Height Factor
Centre height = child height × heightFactor:

Tsx

Preview

NOTE: Previews are not depiction of actual website output.
2c. Both Factors
Control both dimensions:

Tsx

<Centre widthFactor={1.5} heightFactor={2}>
<SizedBox width={100} height={50}>
<Container decoration={{ color: '#eb1660' }} />
</SizedBox>
</Centre>
Result: 150px wide (100 × 1.5) and 100px tall (50 × 2.0).
3. Common Patterns
3a. Loading Spinner

Tsx

Preview

NOTE: Previews are not depiction of actual website output.
3b. Error State

Tsx

Preview

NOTE: Previews are not depiction of actual website output.
3c. Empty State

Tsx

Preview

NOTE: Previews are not depiction of actual website output.
3d. Modal Center

Tsx

Preview

NOTE: Previews are not depiction of actual website output.
3e. Hero Section

Tsx

Preview

NOTE: Previews are not depiction of actual website output.
3f. Logo Placeholder

Tsx

Preview

NOTE: Previews are not depiction of actual website output.
3g. Icon Button

Tsx

Preview

NOTE: Previews are not depiction of actual website output.
3h. Badge

Tsx

Preview

NOTE: Previews are not depiction of actual website output.
3i. Authentication Page

Tsx

Preview

NOTE: Previews are not depiction of actual website output.
4. API Reference
4a. CentreProps
PropTypeDefaultDescription
childrenReactNodeChild widget to center
widthFactornumberWidth multiplier (child width × factor)
heightFactornumberHeight multiplier (child height × factor)
classNamestring''Additional CSS classes
styleCSSProperties{}Custom inline styles
idstringHTML id attribute
4b. Behavior
• No factors: expands to fill parent (100% width and height) • widthFactor set: width equals child width multiplied by factor • heightFactor set: height equals child height multiplied by factor • Always centers using flexbox justify-content and align-items
5. TypeScript

Tsx

import { Centre, type CentreProps } from '@dynshift/layr';
const CenteredCard: React.FC<{ children: React.ReactNode }> = ({ children }) => {
return (
<Container width={400} height={300} decoration={{ color: '#f3f4f6' }}>
<Centre>
{children}
</Centre>
</Container>
);
};
6. Aliases
Centre supports both British and American spellings:

Tsx

import { Centre, Center } from '@dynshift/layr';
// Both work identically
<Centre><span>British</span></Centre>
<Center><span>American</span></Center>