@codecademy/styleguide 79.1.2 → 79.2.0-alpha.097b76.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. package/.storybook/components/Elements/DocsContainer.tsx +4 -0
  2. package/.storybook/components/Elements/Markdown.tsx +0 -1
  3. package/.storybook/preview.ts +27 -0
  4. package/.storybook/theming/GamutThemeProvider.tsx +11 -3
  5. package/CHANGELOG.md +6 -2
  6. package/package.json +2 -2
  7. package/src/lib/Foundations/System/About.mdx +1 -1
  8. package/src/lib/Foundations/System/Props/About.mdx +81 -0
  9. package/src/lib/Foundations/System/Props/Background.mdx +30 -0
  10. package/src/lib/Foundations/System/Props/Border.mdx +53 -0
  11. package/src/lib/Foundations/System/Props/Border.stories.tsx +138 -0
  12. package/src/lib/Foundations/System/Props/Color.mdx +42 -0
  13. package/src/lib/Foundations/System/Props/Color.stories.tsx +47 -0
  14. package/src/lib/Foundations/System/Props/Flex.mdx +28 -0
  15. package/src/lib/Foundations/System/Props/Grid.mdx +31 -0
  16. package/src/lib/Foundations/System/Props/Layout.mdx +45 -0
  17. package/src/lib/Foundations/System/Props/Layout.stories.tsx +46 -0
  18. package/src/lib/Foundations/System/Props/List.mdx +38 -0
  19. package/src/lib/Foundations/System/Props/Positioning.mdx +29 -0
  20. package/src/lib/Foundations/System/Props/Shadow.mdx +31 -0
  21. package/src/lib/Foundations/System/Props/Space.mdx +44 -0
  22. package/src/lib/Foundations/System/Props/Space.stories.tsx +48 -0
  23. package/src/lib/Foundations/System/Props/Typography.mdx +28 -0
  24. package/src/lib/Foundations/System/ResponsiveProperties/ResponsiveProperties.mdx +3 -3
  25. package/src/lib/Foundations/System/ResponsiveProperties/ResponsiveProperties.stories.tsx +1 -0
  26. package/src/lib/Foundations/shared/elements.tsx +69 -19
  27. package/src/lib/Meta/About.mdx +3 -1
  28. package/src/lib/Meta/Logical and physical CSS properties.mdx +123 -0
  29. package/src/lib/Meta/Usage Guide.mdx +6 -1
  30. package/src/lib/Molecules/Popover/Popover.stories.tsx +0 -6
  31. package/src/static/meta/toolbar.png +0 -0
  32. package/src/lib/Foundations/System/Props.mdx +0 -230
@@ -52,6 +52,9 @@ export const DocsContainer: React.FC<{
52
52
 
53
53
  const globalTheme =
54
54
  (context as any).store.userGlobals?.globals?.theme || 'core';
55
+ const globalLogicalProps = (context as any).store.userGlobals?.globals
56
+ ?.logicalProps;
57
+ const useLogicalProperties = globalLogicalProps !== 'false';
55
58
 
56
59
  const { currentTheme } = useMemo(() => {
57
60
  const findThemeStory: keyof typeof themeSpecificStories | undefined =
@@ -77,6 +80,7 @@ export const DocsContainer: React.FC<{
77
80
  cache={createEmotionCache({ speedy: false })}
78
81
  // This is typed to the CoreTheme in theme.d.ts
79
82
  theme={currentTheme as unknown as CoreTheme}
83
+ useLogicalProperties={useLogicalProperties}
80
84
  >
81
85
  <ColorMode mode="light">
82
86
  <HelmetProvider>
@@ -43,7 +43,6 @@ export const Code = styled.code`
43
43
  color: ${themed('colors.navy-700')};
44
44
  background-color: ${themed('colors.gray-100')};
45
45
  display: inline-block;
46
- overflow-x: scroll;
47
46
 
48
47
  ::-webkit-scrollbar {
49
48
  width: 4px;
@@ -49,6 +49,7 @@ const preview: Preview = {
49
49
  'Contributing',
50
50
  'ESLint rules',
51
51
  'FAQs',
52
+ 'Logical and physical CSS properties',
52
53
  'Stories',
53
54
  'Brand',
54
55
  'Installation',
@@ -167,6 +168,32 @@ export const globalTypes = {
167
168
  showName: true,
168
169
  },
169
170
  },
171
+ logicalProps: {
172
+ name: 'LogicalProps',
173
+ description: 'Toggle between logical and physical CSS properties',
174
+ defaultValue: 'true',
175
+ toolbar: {
176
+ icon: 'transfer',
177
+ items: [
178
+ { value: 'true', title: 'Logical' },
179
+ { value: 'false', title: 'Physical' },
180
+ ],
181
+ showName: true,
182
+ },
183
+ },
184
+ direction: {
185
+ name: 'Direction',
186
+ description: 'Text direction (LTR or RTL)',
187
+ defaultValue: 'ltr',
188
+ toolbar: {
189
+ icon: 'arrowright',
190
+ items: [
191
+ { value: 'ltr', title: 'Left-to-Right (LTR)', icon: 'arrowright' },
192
+ { value: 'rtl', title: 'Right-to-Left (RTL)', icon: 'arrowleft' },
193
+ ],
194
+ showName: true,
195
+ },
196
+ },
170
197
  };
171
198
 
172
199
  export const decorators = [withEmotion];
@@ -34,12 +34,16 @@ type GlobalsContext = {
34
34
  globals: {
35
35
  colorMode: 'light' | 'dark';
36
36
  theme: keyof typeof themeMap;
37
+ logicalProps: 'true' | 'false';
38
+ direction: 'ltr' | 'rtl';
37
39
  };
38
40
  };
39
41
 
40
42
  export const withEmotion = (Story: any, context: GlobalsContext) => {
41
43
  const colorMode = context.globals.colorMode ?? 'light';
42
44
  const selectedTheme = context.globals.theme;
45
+ const useLogicalProperties = context.globals.logicalProps !== 'false';
46
+ const direction = context.globals.direction ?? 'ltr';
43
47
  const background = corePalette[themeBackground[colorMode]];
44
48
  const storyRef = useRef<HTMLDivElement>(null);
45
49
  const currentTheme = themeMap[selectedTheme];
@@ -57,6 +61,7 @@ export const withEmotion = (Story: any, context: GlobalsContext) => {
57
61
  <GamutProvider
58
62
  useCache={false}
59
63
  useGlobals={false}
64
+ useLogicalProperties={useLogicalProperties}
60
65
  theme={currentTheme as unknown as Theme}
61
66
  >
62
67
  <Background
@@ -64,7 +69,7 @@ export const withEmotion = (Story: any, context: GlobalsContext) => {
64
69
  bg={themeBackground[colorMode]}
65
70
  ref={storyRef}
66
71
  >
67
- {Story()}
72
+ <div dir={direction}>{Story()}</div>
68
73
  </Background>
69
74
  </GamutProvider>
70
75
  );
@@ -72,13 +77,16 @@ export const withEmotion = (Story: any, context: GlobalsContext) => {
72
77
 
73
78
  // Wrap all stories in minimal provider
74
79
  return (
75
- <GamutProvider theme={currentTheme as unknown as Theme}>
80
+ <GamutProvider
81
+ useLogicalProperties={useLogicalProperties}
82
+ theme={currentTheme as unknown as Theme}
83
+ >
76
84
  <Background
77
85
  alwaysSetVariables
78
86
  bg={themeBackground[colorMode]}
79
87
  ref={storyRef}
80
88
  >
81
- {Story()}
89
+ <div dir={direction}>{Story()}</div>
82
90
  </Background>
83
91
  </GamutProvider>
84
92
  );
package/CHANGELOG.md CHANGED
@@ -3,9 +3,13 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
- ### [79.1.2](https://github.com/Codecademy/gamut/compare/@codecademy/styleguide@79.1.1...@codecademy/styleguide@79.1.2) (2026-02-12)
6
+ ## [79.2.0-alpha.097b76.0](https://github.com/Codecademy/gamut/compare/@codecademy/styleguide@79.1.1...@codecademy/styleguide@79.2.0-alpha.097b76.0) (2026-02-12)
7
7
 
8
- **Note:** Version bump only for package @codecademy/styleguide
8
+ ### Features
9
+
10
+ - Add border related logical props ([#3257](https://github.com/Codecademy/gamut/issues/3257)) ([e852afa](https://github.com/Codecademy/gamut/commit/e852afa6b0f70eb0e3a696c2b0fde7be0047bd5b))
11
+ - Updates to ThemeProvider, tokens, and transform to allow Logical vs Physical prop resolution ([#3234](https://github.com/Codecademy/gamut/issues/3234)) ([7efbb9a](https://github.com/Codecademy/gamut/commit/7efbb9aabcd07dc6429432d007eaa5603ac1d70c))
12
+ - Updates to ThemeProvider, tokens, and transform to allow Logical vs Physical prop resolution ([#3234](https://github.com/Codecademy/gamut/issues/3234)) ([567a6ae](https://github.com/Codecademy/gamut/commit/567a6aeffb3e8628db4b5c9a37dab965b716d969))
9
13
 
10
14
  ### [79.1.1](https://github.com/Codecademy/gamut/compare/@codecademy/styleguide@79.1.0...@codecademy/styleguide@79.1.1) (2026-02-11)
11
15
 
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@codecademy/styleguide",
3
3
  "description": "Styleguide & Component library for codecademy.com",
4
- "version": "79.1.2",
4
+ "version": "79.2.0-alpha.097b76.0",
5
5
  "author": "Codecademy Engineering",
6
6
  "license": "MIT",
7
7
  "publishConfig": {
8
8
  "access": "public"
9
9
  },
10
10
  "repository": "git@github.com:Codecademy/gamut.git",
11
- "gitHead": "bbc4cf8da76ebc754ed05b11acd9d2e81bb8683e"
11
+ "gitHead": "8857953b7b0b50867a212797e6864be0a0caa20a"
12
12
  }
@@ -7,7 +7,7 @@ import {
7
7
  } from '~styleguide/blocks';
8
8
 
9
9
  import { parameters as composeParameters } from './Compose.mdx';
10
- import { parameters as propsParameters } from './Props.mdx';
10
+ import { parameters as propsParameters } from './Props/About.mdx';
11
11
  import { parameters as responsivePropertiesParameters } from './ResponsiveProperties/ResponsiveProperties.mdx';
12
12
  import { parameters as variantsParameters } from './Variants.mdx';
13
13
 
@@ -0,0 +1,81 @@
1
+ import { Meta } from '@storybook/blocks';
2
+
3
+ import {
4
+ AboutHeader,
5
+ addParentPath,
6
+ TableOfContents,
7
+ } from '~styleguide/blocks';
8
+
9
+ import { parameters as backgroundParameters } from './Background.mdx';
10
+ import { parameters as borderParameters } from './Border.mdx';
11
+ import { parameters as colorParameters } from './Color.mdx';
12
+ import { parameters as flexParameters } from './Flex.mdx';
13
+ import { parameters as gridParameters } from './Grid.mdx';
14
+ import { parameters as layoutParameters } from './Layout.mdx';
15
+ import { parameters as listParameters } from './List.mdx';
16
+ import { parameters as positioningParameters } from './Positioning.mdx';
17
+ import { parameters as shadowParameters } from './Shadow.mdx';
18
+ import { parameters as spaceParameters } from './Space.mdx';
19
+ import { parameters as typographyParameters } from './Typography.mdx';
20
+
21
+ export const parameters = {
22
+ id: 'Foundations/System/Props',
23
+ title: 'Props',
24
+ subtitle:
25
+ 'Reusable CSS-in-JS props with predictable behaviors and a consistent API for responsive CSS.',
26
+ status: 'current',
27
+ source: {
28
+ repo: 'gamut-styles',
29
+ githubLink:
30
+ 'https://github.com/Codecademy/gamut/blob/main/packages/gamut-styles/src/variance/config.ts',
31
+ },
32
+ };
33
+
34
+ <Meta title="Foundations/System/Props/About" />
35
+
36
+ <AboutHeader {...parameters} />
37
+
38
+ We provide a set of out of style functions out of the box through `@codecademy/gamut-styles` that are standardized throughout all of our components. These props are strongly typed and can be included as necessary on any styled component.
39
+
40
+ System props have a few facets that are important to note:
41
+
42
+ - They can some times represent multiple properties.
43
+ - They may be restricted to specific token scales but will always have access to global css values like `initial` and `none`.
44
+ - They may have a function that transforms the given value into a standardized value (e.g. `width={.5}` => `width: 50%`)
45
+
46
+ We've grouped these into a few main groups that affect simliar behaviors: `layout`, `space`, `color`, `border`, `background`, `typography`, `positioning`, `grid`, `flex`, `shadow`.
47
+
48
+ You may import these groups directly from `gamut-styles`.
49
+
50
+ ```tsx
51
+ import { variance } from '@codecademy/variance';
52
+ import { system } from '@codecademy/gamut-styles';
53
+
54
+ const ExampleContainer = styled.div(
55
+ variance.compose(system.layout, system.positioning)
56
+ );
57
+
58
+ <ExampleContainer position="absolute" width="50px" height="50px" />;
59
+ ```
60
+
61
+ Each system prop has 3 important features:
62
+
63
+ - `properties`: Any number of CSS Properties this prop is responsible for.
64
+ - `scale`: A set of values that determines valid inputs for each prop based on the selected theme and that theme's typing (e.g. if the `lxStudio` theme is being used, a scale of `colors` will restrict to the `lxStudio` theme's colors). These are generally aliases for more verbose or opaque CSS properties allowing you to specify a human readable name in your props. If a prop doesn't have a scale that means it accepts all valid `CSSType` values as props, however if it does have a scale it will only accept global values and keys of the provided scale.
65
+ - `transform`: A function that changes the prop / scale value prior to adding it to the stylehseet. This allows us to add / change units for properties like `width` and `height`. Or ensure extra defaults or fallbacks are added dynamically.
66
+
67
+ <TableOfContents
68
+ links={addParentPath(parameters.id, [
69
+ layoutParameters,
70
+ spaceParameters,
71
+ typographyParameters,
72
+ colorParameters,
73
+ borderParameters,
74
+ flexParameters,
75
+ gridParameters,
76
+ backgroundParameters,
77
+ positioningParameters,
78
+ shadowParameters,
79
+ listParameters,
80
+ ])}
81
+ />
@@ -0,0 +1,30 @@
1
+ import { Meta } from '@storybook/blocks';
2
+
3
+ import { AboutHeader, TokenTable } from '~styleguide/blocks';
4
+
5
+ import { defaultColumns, getPropRows } from '../../shared/elements';
6
+
7
+ export const parameters = {
8
+ title: 'Background',
9
+ subtitle:
10
+ 'Props for background manipulation (sizing / repitition / images), for background color see `colors`.',
11
+ status: 'current',
12
+ };
13
+
14
+ <Meta title="Foundations/System/Props/Background" />
15
+
16
+ <AboutHeader {...parameters} />
17
+
18
+ Background props control how background images and patterns are displayed on elements. These properties give you control over image sizing, positioning, and repetition behavior. For solid background colors, use the color props which connect to the theme's color palette.
19
+
20
+ ```tsx
21
+ import styled from '@emotion/styled';
22
+ import { system } from '@codecademy/gamut-styles';
23
+ import myBg from './myBg.png';
24
+
25
+ const BackgroundExample = styled.div(system.background);
26
+
27
+ <BackgroundExample background={`url(${myBg}`} backgroundSize="cover" />;
28
+ ```
29
+
30
+ <TokenTable rows={getPropRows('background')} columns={defaultColumns} />
@@ -0,0 +1,53 @@
1
+ import { Canvas, Meta } from '@storybook/blocks';
2
+
3
+ import { AboutHeader, Callout, TokenTable } from '~styleguide/blocks';
4
+
5
+ import { defaultColumns, getPropRows } from '../../shared/elements';
6
+ import * as BorderStories from './Border.stories';
7
+
8
+ export const parameters = {
9
+ title: 'Border',
10
+ subtitle: 'Border styles',
11
+ status: 'updating',
12
+ };
13
+
14
+ <Meta of={BorderStories} title="Foundations/System/Props/Border" />
15
+
16
+ <AboutHeader {...parameters} />
17
+
18
+ Border props enable you to add and style borders on any side of an element. These properties support directional borders (top, right, bottom, left) as well as convenient shorthands for horizontal and vertical borders. Border radius values connect to the theme's `borderRadii` scale for consistent corner rounding.
19
+
20
+ ```tsx
21
+ import styled from '@emotion/styled';
22
+ import { system } from '@codecademy/gamut-styles';
23
+
24
+ const BorderExample = styled.div(system.border);
25
+
26
+ <BorderExample
27
+ border={1}
28
+ borderLeft="none"
29
+ borderRightStyle="dotted"
30
+ borderRadius="md"
31
+ />;
32
+ ```
33
+
34
+ These border props support both physical and logical CSS properties and will render the appropriate properties based on `useLogicalProperties`'s value passed into the `<GamutProvider>` at the root of your application.
35
+
36
+ <Callout
37
+ text={
38
+ <>
39
+ You can use the <strong>LogicalProps</strong> button in the toolbar to
40
+ switch between modes.
41
+ </>
42
+ }
43
+ />
44
+
45
+ <Canvas of={BorderStories.DirectionalBorderExample} />
46
+
47
+ <Canvas of={BorderStories.BorderWidthExample} />
48
+
49
+ <Canvas of={BorderStories.BorderRadiusExample} />
50
+
51
+ <Canvas of={BorderStories.BorderStyleExample} />
52
+
53
+ <TokenTable rows={getPropRows('border')} columns={defaultColumns} />
@@ -0,0 +1,138 @@
1
+ import { Box, FlexBox, Markdown } from '@codecademy/gamut';
2
+ import type { Meta, StoryObj } from '@storybook/react';
3
+
4
+ const meta: Meta<typeof Box> = {
5
+ title: 'Foundations/System/Props/Border',
6
+ component: Box,
7
+ };
8
+
9
+ export default meta;
10
+ type Story = StoryObj<typeof Box>;
11
+
12
+ export const DirectionalBorderExample: Story = {
13
+ render: () => (
14
+ <FlexBox gap={16} row>
15
+ <Box
16
+ bg="background-selected"
17
+ borderX={2}
18
+ borderY={1}
19
+ p={16}
20
+ textAlign="center"
21
+ >
22
+ This box has <Markdown text="`borderX={2}`, `borderY={1}`." /> Inspect
23
+ the example to see what CSS properties are rendered based on the logical
24
+ properties mode.
25
+ </Box>
26
+ <Box
27
+ bg="background-selected"
28
+ borderLeft={2}
29
+ borderRight={1}
30
+ p={16}
31
+ textAlign="center"
32
+ >
33
+ This box has <Markdown text="`borderLeft={2}`, `borderRight={1}`." />{' '}
34
+ Inspect the example to see what CSS properties are rendered based on the
35
+ logical properties mode.
36
+ </Box>
37
+ </FlexBox>
38
+ ),
39
+ };
40
+
41
+ export const BorderWidthExample: Story = {
42
+ render: () => (
43
+ <FlexBox gap={16} row>
44
+ <Box
45
+ bg="background-selected"
46
+ border={1}
47
+ borderWidthX="4px"
48
+ borderWidthY="10px"
49
+ p={16}
50
+ textAlign="center"
51
+ >
52
+ This box has{' '}
53
+ <Markdown text="`borderWidthX='4px'` and `borderWidthY='10px'`." />{' '}
54
+ Inspect the example to see what CSS properties are rendered based on the
55
+ logical properties mode.
56
+ </Box>
57
+ <Box
58
+ bg="background-selected"
59
+ border={1}
60
+ borderWidthRight="10px"
61
+ borderWidthTop="4px"
62
+ p={16}
63
+ textAlign="center"
64
+ >
65
+ This box has{' '}
66
+ <Markdown text="`borderWidthTop='4px'` and `borderWidthRight='10px'`." />{' '}
67
+ Inspect the example to see what CSS properties are rendered based on the
68
+ logical properties mode.
69
+ </Box>
70
+ </FlexBox>
71
+ ),
72
+ };
73
+
74
+ export const BorderRadiusExample: Story = {
75
+ render: () => (
76
+ <FlexBox gap={16} row>
77
+ <Box
78
+ bg="background-selected"
79
+ border={1}
80
+ borderRadiusLeft="lg"
81
+ borderRadiusRight="none"
82
+ p={16}
83
+ textAlign="center"
84
+ >
85
+ This box has{' '}
86
+ <Markdown text="`borderRadiusLeft='lg'` and `borderRadiusRight='none'`." />{' '}
87
+ Inspect the example to see what CSS properties are rendered based on the
88
+ logical properties mode.
89
+ </Box>
90
+ <Box
91
+ bg="background-selected"
92
+ border={1}
93
+ borderRadiusBottomLeft="xl"
94
+ borderRadiusTopRight="xl"
95
+ p={16}
96
+ textAlign="center"
97
+ >
98
+ This box has{' '}
99
+ <Markdown text="`borderRadiusTopRight='xl'` and `borderRadiusBottomLeft='xl'`." />{' '}
100
+ Inspect the example to see what CSS properties are rendered based on the
101
+ logical properties mode.
102
+ </Box>
103
+ </FlexBox>
104
+ ),
105
+ };
106
+
107
+ export const BorderStyleExample: Story = {
108
+ render: () => (
109
+ <FlexBox gap={16} row>
110
+ <Box
111
+ bg="background-selected"
112
+ border={1}
113
+ borderStyleX="dashed"
114
+ borderStyleY="dotted"
115
+ p={16}
116
+ textAlign="center"
117
+ >
118
+ This box has{' '}
119
+ <Markdown text="`borderStyleX='dashed'` and `borderStyleY='dotted'`." />{' '}
120
+ Inspect the example to see what CSS properties are rendered based on the
121
+ logical properties mode.
122
+ </Box>
123
+ <Box
124
+ bg="background-selected"
125
+ border={1}
126
+ borderStyleBottom="dotted"
127
+ borderStyleLeft="dashed"
128
+ p={16}
129
+ textAlign="center"
130
+ >
131
+ This box has{' '}
132
+ <Markdown text="`borderStyleBottom='dotted'` and `borderStyleLeft='dashed'`." />{' '}
133
+ Inspect the example to see what CSS properties are rendered based on the
134
+ logical properties mode.
135
+ </Box>
136
+ </FlexBox>
137
+ ),
138
+ };
@@ -0,0 +1,42 @@
1
+ import { Canvas, Meta } from '@storybook/blocks';
2
+
3
+ import { AboutHeader, Callout, TokenTable } from '~styleguide/blocks';
4
+
5
+ import { defaultColumns, getPropRows } from '../../shared/elements';
6
+ import * as ColorStories from './Color.stories';
7
+
8
+ export const parameters = {
9
+ title: 'Color',
10
+ subtitle: 'Specific color properties',
11
+ status: 'current',
12
+ };
13
+
14
+ <Meta of={ColorStories} title="Foundations/System/Props/Color" />
15
+
16
+ <AboutHeader {...parameters} />
17
+
18
+ Color props control the foreground, background, and border colors of elements. All color values are restricted to your theme's color palette, ensuring consistent color usage throughout your application. The `bg` shorthand provides a convenient way to set background colors quickly.
19
+
20
+ ```tsx
21
+ import styled from '@emotion/styled';
22
+ import { system } from '@codecademy/gamut-styles';
23
+
24
+ const ColorExample = styled.div(system.color);
25
+
26
+ <ColorExample bg="navy" textColor="gray-100" borderColor="blue" />;
27
+ ```
28
+
29
+ These color props support both physical and logical CSS properties and will render the appropriate properties based on `useLogicalProperties`'s value passed into the `<GamutProvider>` at the root of your application.
30
+
31
+ <Callout
32
+ text={
33
+ <>
34
+ You can use the <strong>LogicalProps</strong> button in the toolbar to
35
+ switch between modes.
36
+ </>
37
+ }
38
+ />
39
+
40
+ <Canvas of={ColorStories.BorderColorExample} />
41
+
42
+ <TokenTable rows={getPropRows('color')} columns={defaultColumns} />
@@ -0,0 +1,47 @@
1
+ import { Box, FlexBox, Markdown } from '@codecademy/gamut';
2
+ import type { Meta, StoryObj } from '@storybook/react';
3
+
4
+ const meta: Meta<typeof Box> = {
5
+ title: 'Foundations/System/Props/Color',
6
+ component: Box,
7
+ };
8
+
9
+ export default meta;
10
+ type Story = StoryObj<typeof Box>;
11
+
12
+ export const BorderColorExample: Story = {
13
+ render: () => (
14
+ <FlexBox gap={16} row>
15
+ <Box
16
+ bg="background-selected"
17
+ border={1}
18
+ borderColorX="feedback-success"
19
+ borderColorY="feedback-error"
20
+ borderWidth="4px"
21
+ p={16}
22
+ textAlign="center"
23
+ >
24
+ This box has{' '}
25
+ <Markdown text="`borderColorX='feedback-success'` and `borderColorY='feedback-error'`." />{' '}
26
+ Inspect the example to see what CSS properties are rendered based on the
27
+ logical properties mode.
28
+ </Box>
29
+ <Box
30
+ bg="background-selected"
31
+ border={1}
32
+ borderColorBottom="feedback-warning"
33
+ borderColorLeft="feedback-success"
34
+ borderColorRight="feedback-error"
35
+ borderColorTop="interface"
36
+ borderWidth="4px"
37
+ p={16}
38
+ textAlign="center"
39
+ >
40
+ This box has{' '}
41
+ <Markdown text="`borderColorBottom='feedback-warning'`, `borderColorLeft='feedback-success'`, `borderColorRight='feedback-error'`, and `borderColorTop='interface'`." />{' '}
42
+ Inspect the example to see what CSS properties are rendered based on the
43
+ logical properties mode.
44
+ </Box>
45
+ </FlexBox>
46
+ ),
47
+ };
@@ -0,0 +1,28 @@
1
+ import { Meta } from '@storybook/blocks';
2
+
3
+ import { AboutHeader, TokenTable } from '~styleguide/blocks';
4
+
5
+ import { defaultColumns, getPropRows } from '../../shared/elements';
6
+
7
+ export const parameters = {
8
+ title: 'Flex',
9
+ subtitle: 'Flex specific properties',
10
+ status: 'current',
11
+ };
12
+
13
+ <Meta title="Foundations/System/Props/Flex" />
14
+
15
+ <AboutHeader {...parameters} />
16
+
17
+ Flex props provide complete control over flexbox layouts, from container behavior to individual flex item properties. These properties make it easy to create flexible, responsive layouts with proper alignment and distribution of child elements. Use these on flex containers to control their children or on flex items to control their own behavior.
18
+
19
+ ```tsx
20
+ import styled from '@emotion/styled';
21
+ import { system } from '@codecademy/gamut-styles';
22
+
23
+ const FlexExample = styled.div(system.flex);
24
+
25
+ <FlexExample flex={1} justifyContent="center" alignItems="flex-start" />;
26
+ ```
27
+
28
+ <TokenTable rows={getPropRows('flex')} columns={defaultColumns} />
@@ -0,0 +1,31 @@
1
+ import { Meta } from '@storybook/blocks';
2
+
3
+ import { AboutHeader, TokenTable } from '~styleguide/blocks';
4
+
5
+ import { defaultColumns, getPropRows } from '../../shared/elements';
6
+
7
+ export const parameters = {
8
+ title: 'Grid',
9
+ subtitle: 'Grid specific properties',
10
+ status: 'current',
11
+ };
12
+
13
+ <Meta title="Foundations/System/Props/Grid" />
14
+
15
+ <AboutHeader {...parameters} />
16
+
17
+ Grid props give you powerful control over CSS Grid layouts. Define grid templates, control auto-placement behavior, and set gaps between grid items. These properties make it straightforward to create complex, responsive grid layouts with precise control over both container and item positioning.
18
+
19
+ ```tsx
20
+ import styled from '@emotion/styled';
21
+ import { system } from '@codecademy/gamut-styles';
22
+
23
+ const GridExample = styled.div(system.grid);
24
+
25
+ <GridExample
26
+ gridTemplateColumns="max-content 1fr max-content"
27
+ columnGap={32}
28
+ />;
29
+ ```
30
+
31
+ <TokenTable rows={getPropRows('grid')} columns={defaultColumns} />
@@ -0,0 +1,45 @@
1
+ import { Canvas, Meta } from '@storybook/blocks';
2
+
3
+ import { AboutHeader, TokenTable } from '~styleguide/blocks';
4
+
5
+ import { defaultColumns, getPropRows } from '../../shared/elements';
6
+ import * as LayoutStories from './Layout.stories';
7
+
8
+ export const parameters = {
9
+ title: 'Layout',
10
+ subtitle:
11
+ 'Props for handling dimensions and other layout specific properties.',
12
+ status: 'updating',
13
+ };
14
+
15
+ <Meta title="Foundations/System/Props/Layout" of={LayoutStories} />
16
+
17
+ <AboutHeader {...parameters} />
18
+
19
+ Layout props control the visual structure and dimensions of elements. These properties determine how components take up space, their display behavior, and how they align within their containers. Use these props to set widths, heights, overflow behavior, and container types for responsive layouts.
20
+
21
+ ```tsx
22
+ import styled from '@emotion/styled';
23
+ import { system } from '@codecademy/gamut-styles';
24
+
25
+ const LayoutExample = styled.div(system.layout);
26
+
27
+ <LayoutExample
28
+ display="flex"
29
+ width="50%"
30
+ height="300px"
31
+ verticalAlign="middle"
32
+ />;
33
+ ```
34
+
35
+ ## Examples
36
+
37
+ ### Width
38
+
39
+ <Canvas of={LayoutStories.WidthExample} />
40
+
41
+ ### Direction
42
+
43
+ <Canvas of={LayoutStories.DirectionExample} />
44
+
45
+ <TokenTable rows={getPropRows('layout')} columns={defaultColumns} />