Skip to content

Open source website builder and Webflow alternative. Webstudio is an advanced visual builder that connects to any headless CMS, supports all CSS properties, and can be hosted anywhere, including with us.

prevent line break on outline label - if element is small it would go multi line if label has space e.g. Bold Text

Oleg Isonen56e2af1c9557
diff --git a/app/designer/features/workspace/canvas-tools/outline/label.tsx b/app/designer/features/workspace/canvas-tools/outline/label.tsx
index 828593bb54..3624bcebb3 100644
--- a/app/designer/features/workspace/canvas-tools/outline/label.tsx
+++ b/app/designer/features/workspace/canvas-tools/outline/label.tsx
@@ -12,7 +12,9 @@ type LabelRefCallback = (element: HTMLElement | null) => void;
* - else if instance height is more than 250px - bottom
* - else inside-top - last resort because it covers a bit of the instance content
*/
-const useLabelPosition = (instanceRect: DOMRect): [LabelRefCallback, LabelPosition] => {
+const useLabelPosition = (
+ instanceRect: DOMRect
+): [LabelRefCallback, LabelPosition] => {
const [position, setPosition] = useState<LabelPosition>("top");
const ref = useCallback(
@@ -45,7 +47,8 @@ const LabelContainer = styled(
fontSize: "$2",
fontFamily: "$sans",
lineHeight: 1,
- minWidth: "$6"
+ minWidth: "$6",
+ whiteSpace: "nowrap",
},
{
variants: {
@@ -72,13 +75,13 @@ const LabelContainer = styled(
}
);
-type LabelProps = {
- component: Instance['component'],
- instanceRect: DOMRect,
- state: 'hovered' | 'selected'
-}
+type LabelProps = {
+ component: Instance["component"];
+ instanceRect: DOMRect;
+ state: "hovered" | "selected";
+};
-export const Label = ({component, instanceRect, state}: LabelProps) => {
+export const Label = ({ component, instanceRect, state }: LabelProps) => {
const [labelRef, position] = useLabelPosition(instanceRect);
const primitive = primitives[component];
const { Icon } = primitive;