+
+ { __( 'Orientation' ) }
+
+
+ { WRITING_MODES.map( ( writingMode ) => {
+ return (
+
+
+ );
+}
diff --git a/packages/block-editor/src/components/writing-mode-control/style.scss b/packages/block-editor/src/components/writing-mode-control/style.scss
new file mode 100644
index 0000000000000..4b865dc0282c0
--- /dev/null
+++ b/packages/block-editor/src/components/writing-mode-control/style.scss
@@ -0,0 +1,18 @@
+.block-editor-writing-mode-control {
+ border: 0;
+ margin: 0;
+ padding: 0;
+
+ .block-editor-writing-mode-control__buttons {
+ // 4px of padding makes the row 40px high, same as an input.
+ padding: $grid-unit-05 0;
+ display: flex;
+ }
+
+ .components-button.has-icon {
+ height: $grid-unit-40;
+ margin-right: $grid-unit-05;
+ min-width: $grid-unit-40;
+ padding: 0;
+ }
+}
diff --git a/packages/block-editor/src/hooks/supports.js b/packages/block-editor/src/hooks/supports.js
index ead8ca89aa47d..2cf08d46fa8fe 100644
--- a/packages/block-editor/src/hooks/supports.js
+++ b/packages/block-editor/src/hooks/supports.js
@@ -30,11 +30,17 @@ const TEXT_COLUMNS_SUPPORT_KEY = 'typography.textColumns';
* decorations e.g. settings found in `block.json`.
*/
const TEXT_DECORATION_SUPPORT_KEY = 'typography.__experimentalTextDecoration';
+/**
+ * Key within block settings' supports array indicating support for writing mode
+ * e.g. settings found in `block.json`.
+ */
+const WRITING_MODE_SUPPORT_KEY = 'typography.__experimentalWritingMode';
/**
* Key within block settings' supports array indicating support for text
* transforms e.g. settings found in `block.json`.
*/
const TEXT_TRANSFORM_SUPPORT_KEY = 'typography.__experimentalTextTransform';
+
/**
* Key within block settings' supports array indicating support for letter-spacing
* e.g. settings found in `block.json`.
@@ -50,6 +56,7 @@ const TYPOGRAPHY_SUPPORT_KEYS = [
TEXT_COLUMNS_SUPPORT_KEY,
TEXT_DECORATION_SUPPORT_KEY,
TEXT_TRANSFORM_SUPPORT_KEY,
+ WRITING_MODE_SUPPORT_KEY,
LETTER_SPACING_SUPPORT_KEY,
];
const SPACING_SUPPORT_KEY = 'spacing';
diff --git a/packages/block-editor/src/hooks/typography.js b/packages/block-editor/src/hooks/typography.js
index cb98c4098c477..c7d1a6ba3b144 100644
--- a/packages/block-editor/src/hooks/typography.js
+++ b/packages/block-editor/src/hooks/typography.js
@@ -30,6 +30,7 @@ const TEXT_DECORATION_SUPPORT_KEY = 'typography.__experimentalTextDecoration';
const TEXT_COLUMNS_SUPPORT_KEY = 'typography.textColumns';
const FONT_STYLE_SUPPORT_KEY = 'typography.__experimentalFontStyle';
const FONT_WEIGHT_SUPPORT_KEY = 'typography.__experimentalFontWeight';
+const WRITING_MODE_SUPPORT_KEY = 'typography.__experimentalWritingMode';
export const TYPOGRAPHY_SUPPORT_KEY = 'typography';
export const TYPOGRAPHY_SUPPORT_KEYS = [
LINE_HEIGHT_SUPPORT_KEY,
@@ -39,6 +40,7 @@ export const TYPOGRAPHY_SUPPORT_KEYS = [
FONT_FAMILY_SUPPORT_KEY,
TEXT_COLUMNS_SUPPORT_KEY,
TEXT_DECORATION_SUPPORT_KEY,
+ WRITING_MODE_SUPPORT_KEY,
TEXT_TRANSFORM_SUPPORT_KEY,
LETTER_SPACING_SUPPORT_KEY,
];
diff --git a/packages/block-editor/src/hooks/utils.js b/packages/block-editor/src/hooks/utils.js
index 8c525e78e4c6e..ccc5dcd9ff2e2 100644
--- a/packages/block-editor/src/hooks/utils.js
+++ b/packages/block-editor/src/hooks/utils.js
@@ -136,6 +136,7 @@ export function useBlockSettings( name, parentLayout ) {
const lineHeight = useSetting( 'typography.lineHeight' );
const textColumns = useSetting( 'typography.textColumns' );
const textDecoration = useSetting( 'typography.textDecoration' );
+ const writingMode = useSetting( 'typography.writingMode' );
const textTransform = useSetting( 'typography.textTransform' );
const letterSpacing = useSetting( 'typography.letterSpacing' );
const padding = useSetting( 'spacing.padding' );
@@ -211,6 +212,7 @@ export function useBlockSettings( name, parentLayout ) {
textDecoration,
textTransform,
letterSpacing,
+ writingMode,
},
spacing: {
spacingSizes: {
@@ -244,6 +246,7 @@ export function useBlockSettings( name, parentLayout ) {
textDecoration,
textTransform,
letterSpacing,
+ writingMode,
padding,
margin,
blockGap,
diff --git a/packages/block-library/src/paragraph/block.json b/packages/block-library/src/paragraph/block.json
index cbabc108eca31..7e13b13dc4feb 100644
--- a/packages/block-library/src/paragraph/block.json
+++ b/packages/block-library/src/paragraph/block.json
@@ -58,6 +58,7 @@
"__experimentalFontWeight": true,
"__experimentalLetterSpacing": true,
"__experimentalTextTransform": true,
+ "__experimentalWritingMode": true,
"__experimentalDefaultControls": {
"fontSize": true
}
diff --git a/packages/block-library/src/post-navigation-link/block.json b/packages/block-library/src/post-navigation-link/block.json
index 4e7df560c69b3..e1b6d4fa90a40 100644
--- a/packages/block-library/src/post-navigation-link/block.json
+++ b/packages/block-library/src/post-navigation-link/block.json
@@ -45,6 +45,7 @@
"__experimentalTextTransform": true,
"__experimentalTextDecoration": true,
"__experimentalLetterSpacing": true,
+ "__experimentalWritingMode": true,
"__experimentalDefaultControls": {
"fontSize": true
}
diff --git a/packages/blocks/src/api/constants.js b/packages/blocks/src/api/constants.js
index 6fe04c07de1bf..fb4e4efa4e083 100644
--- a/packages/blocks/src/api/constants.js
+++ b/packages/blocks/src/api/constants.js
@@ -215,6 +215,11 @@ export const __EXPERIMENTAL_STYLE_PROPERTY = {
support: [ 'typography', '__experimentalLetterSpacing' ],
useEngine: true,
},
+ writingMode: {
+ value: [ 'typography', 'writingMode' ],
+ support: [ 'typography', '__experimentalWritingMode' ],
+ useEngine: true,
+ },
'--wp--style--root--padding': {
value: [ 'spacing', 'padding' ],
support: [ 'spacing', 'padding' ],
diff --git a/packages/edit-site/src/components/global-styles/stories/index.js b/packages/edit-site/src/components/global-styles/stories/index.js
index f5e31cc142c0f..f04387295c458 100644
--- a/packages/edit-site/src/components/global-styles/stories/index.js
+++ b/packages/edit-site/src/components/global-styles/stories/index.js
@@ -367,6 +367,7 @@ const BASE_SETTINGS = {
textColumns: false,
textDecoration: true,
textTransform: true,
+ writingMode: false,
fluid: true,
fontFamilies: {
theme: [
diff --git a/packages/icons/src/index.js b/packages/icons/src/index.js
index 903d6f9455a87..1f15620ff6b22 100644
--- a/packages/icons/src/index.js
+++ b/packages/icons/src/index.js
@@ -255,6 +255,8 @@ export { default as sidesRight } from './library/sides-right';
export { default as sidesTop } from './library/sides-top';
export { default as sidesVertical } from './library/sides-vertical';
export { default as textColor } from './library/text-color';
+export { default as textHorizontal } from './library/text-horizontal';
+export { default as textVertical } from './library/text-vertical';
export { default as tablet } from './library/tablet';
export { default as title } from './library/title';
export { default as tip } from './library/tip';
diff --git a/packages/icons/src/library/text-horizontal.js b/packages/icons/src/library/text-horizontal.js
new file mode 100644
index 0000000000000..3f82ee1fba4cb
--- /dev/null
+++ b/packages/icons/src/library/text-horizontal.js
@@ -0,0 +1,12 @@
+/**
+ * WordPress dependencies
+ */
+import { SVG, Path } from '@wordpress/primitives';
+
+const textHorizontal = (
+
+);
+
+export default textHorizontal;
diff --git a/packages/icons/src/library/text-vertical.js b/packages/icons/src/library/text-vertical.js
new file mode 100644
index 0000000000000..406561bee97cc
--- /dev/null
+++ b/packages/icons/src/library/text-vertical.js
@@ -0,0 +1,12 @@
+/**
+ * WordPress dependencies
+ */
+import { SVG, Path } from '@wordpress/primitives';
+
+const textVertical = (
+
+);
+
+export default textVertical;
diff --git a/packages/style-engine/class-wp-style-engine.php b/packages/style-engine/class-wp-style-engine.php
index d62f245364103..ec66168bc1a9a 100644
--- a/packages/style-engine/class-wp-style-engine.php
+++ b/packages/style-engine/class-wp-style-engine.php
@@ -241,6 +241,12 @@ final class WP_Style_Engine {
),
'path' => array( 'typography', 'letterSpacing' ),
),
+ 'writingMode' => array(
+ 'property_keys' => array(
+ 'default' => 'writing-mode',
+ ),
+ 'path' => array( 'typography', 'writingMode' ),
+ ),
),
);
diff --git a/packages/style-engine/src/styles/typography/index.ts b/packages/style-engine/src/styles/typography/index.ts
index 66e89d0e56209..92c40d2e15619 100644
--- a/packages/style-engine/src/styles/typography/index.ts
+++ b/packages/style-engine/src/styles/typography/index.ts
@@ -112,6 +112,18 @@ const textTransform = {
},
};
+const writingMode = {
+ name: 'writingMode',
+ generate: ( style: Style, options: StyleOptions ) => {
+ return generateRule(
+ style,
+ options,
+ [ 'typography', 'writingMode' ],
+ 'writingMode'
+ );
+ },
+};
+
export default [
fontFamily,
fontSize,
@@ -122,4 +134,5 @@ export default [
textColumns,
textDecoration,
textTransform,
+ writingMode,
];
diff --git a/packages/style-engine/src/types.ts b/packages/style-engine/src/types.ts
index 23d3e38cc43c2..4b6a9aa72257e 100644
--- a/packages/style-engine/src/types.ts
+++ b/packages/style-engine/src/types.ts
@@ -55,6 +55,7 @@ export interface Style {
textColumns?: CSSProperties[ 'columnCount' ];
textDecoration?: CSSProperties[ 'textDecoration' ];
textTransform?: CSSProperties[ 'textTransform' ];
+ writingMode?: CSSProperties[ 'writingMode' ];
};
color?: {
text?: CSSProperties[ 'color' ];
diff --git a/schemas/json/theme.json b/schemas/json/theme.json
index 03a966f7f3eee..7f0e712283b60 100644
--- a/schemas/json/theme.json
+++ b/schemas/json/theme.json
@@ -458,6 +458,11 @@
"type": "boolean",
"default": true
},
+ "writingMode": {
+ "description": "Allow users to set the writing mode.",
+ "type": "boolean",
+ "default": false
+ },
"textTransform": {
"description": "Allow users to set custom text transforms.",
"type": "boolean",
@@ -1508,6 +1513,17 @@
}
]
},
+ "writingMode": {
+ "description": "Sets the `writing-mode` CSS property.",
+ "oneOf": [
+ {
+ "type": "string"
+ },
+ {
+ "$ref": "#/definitions/refComplete"
+ }
+ ]
+ },
"textTransform": {
"description": "Sets the `text-transform` CSS property.",
"oneOf": [