From b365698d2737563060fb8e89b5abd415ccff9a23 Mon Sep 17 00:00:00 2001 From: GUOZIJAN Date: Fri, 30 Oct 2026 02:25:18 +0800 Subject: [PATCH 1/2] fix(Text): render icon before title instead of before value The icon was rendered inside DisplayText, between the label (title) and the value. Render it through the label instead so it appears before the title, as specified in #2170. --- src/app-components/Text/DisplayText.tsx | 13 +------------ src/components/label/Label.tsx | 3 +++ src/layout/Text/TextComponent.tsx | 9 +++++++-- 3 files changed, 11 insertions(+), 14 deletions(-) diff --git a/src/app-components/Text/DisplayText.tsx b/src/app-components/Text/DisplayText.tsx index 3cf5b63167..6502444ae4 100644 --- a/src/app-components/Text/DisplayText.tsx +++ b/src/app-components/Text/DisplayText.tsx @@ -1,23 +1,12 @@ import React from 'react'; -import classes from 'src/app-components/Text/Text.module.css'; - interface TextProps { value: string; - iconUrl?: string; - iconAltText?: string; labelId?: string; } -export const DisplayText = ({ value, iconUrl, iconAltText, labelId }: TextProps) => ( +export const DisplayText = ({ value, labelId }: TextProps) => ( <> - {iconUrl && ( - {iconAltText} - )} {labelId && {value}} {!labelId && {value}} diff --git a/src/components/label/Label.tsx b/src/components/label/Label.tsx index e4a2f862ad..a44a1c4744 100644 --- a/src/components/label/Label.tsx +++ b/src/components/label/Label.tsx @@ -24,6 +24,7 @@ export type LabelProps = PropsWithChildren<{ className?: string; overrideId?: string; textResourceBindings?: ExprResolved; + icon?: React.ReactNode; }> & DesignsystemetLabelProps; @@ -46,6 +47,7 @@ export function LabelInner(props: LabelInnerProps) { overrideId, renderLabelAs, className, + icon, textResourceBindings: overriddenTrb, ...designsystemetLabelProps } = props; @@ -100,6 +102,7 @@ export function LabelInner(props: LabelInnerProps) { > {/* we want this "label" not to be rendered as a