Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions src/components/Checkbox/Checkbox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,11 @@ export function Checkbox({
)}
{...fieldsetProps}
>
<legend className="form-label" {...legendProps}>
{legendProps?.children ?? label}
</legend>
{(legendProps || label) && (
<legend className="form-label" {...legendProps}>
{legendProps?.children ?? label}
</legend>
)}
{hint && (
<span className="form-hint" id={id + "-hint"}>
{hint}
Expand Down Expand Up @@ -123,7 +125,7 @@ export function Checkbox({
<label className="form-label" htmlFor={option.id}>
{option.label}
</label>
{option.tooltip && <Tooltip {...option.tooltip} />}
{option.tooltip && <Tooltip inline {...option.tooltip} />}
{option.hint && (
<span className="form-hint" id={option.id + "-hint"}>
{option.hint}
Expand Down
2 changes: 1 addition & 1 deletion src/components/InputField/InputField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ export function InputField({
<label className="form-label" htmlFor={inputProps.id} {...labelProps}>
{label ?? labelProps?.children}
</label>
{tooltip && <Tooltip {...tooltip} />}
{tooltip && <Tooltip inline {...tooltip} />}
{hint && (
<span className="form-hint" id={inputProps.id + "-hint"}>
{hint}
Expand Down
2 changes: 1 addition & 1 deletion src/components/RadioButtons/RadioButtons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ export function RadioButtons({
>
<legend className="form-label" {...legendProps}>
{legendProps?.children ?? label}
{tooltip && <Tooltip {...tooltip} />}
{tooltip && <Tooltip inline {...tooltip} />}
</legend>
{hint && (
<span className="form-hint" id={id + "-hint"}>
Expand Down
10 changes: 8 additions & 2 deletions src/components/Tooltip/Tooltip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export type TooltipProps = {
position: "above" | "below";
trigger: "click" | "hover";
forceVisible?: boolean;
noMargin?: boolean;
children?: React.ReactNode;
tooltipId?: string;
};
Expand All @@ -38,6 +39,7 @@ export const Tooltip = forwardRef(function Tooltip(
tooltipId,
position,
icon = "help",
noMargin = false,
tooltipIsLabel = false,
inText = false,
forceVisible = false,
Expand Down Expand Up @@ -79,7 +81,11 @@ export const Tooltip = forwardRef(function Tooltip(
return (
<Container
ref={ref}
className={mergeStrings("tooltip-wrapper", inText && "in-text")}
className={mergeStrings(
"tooltip-wrapper",
inText && "in-text",
noMargin && "mt-0 mb-0",
)}
data-tooltip={tooltip}
data-tooltip-id={tooltipId ?? id}
data-position={position}
Expand All @@ -93,7 +99,7 @@ export const Tooltip = forwardRef(function Tooltip(
"tooltip-target",
tooltipIsLabel && "tooltip-label",
)}
buttonType="icon-only"
buttonType="unstyled"
type="button"
aria-label="Læs mere"
aria-controls={tooltipId ?? id}
Expand Down