Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -95,3 +95,17 @@

.v-selection-control--focus-visible &::before
opacity: calc(#{map.get(settings.$states, 'focus')} * var(--v-theme-overlay-multiplier))

.v-selection-control__label-wrapper
display: flex
flex-direction: column
justify-content: center
flex: 1

.v-label
display: block

.v-selection-control__description
font-size: $selection-control-description-font-size
color: $selection-control-description-color
line-height: 1.4
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,14 @@ export type VSelectionControlSlots = {
backgroundColorStyles: Ref<CSSProperties>
}
label: { label: string | undefined, props: Record<string, unknown> }
description: { description: string | undefined }
input: SelectionControlSlot
}

export const makeVSelectionControlProps = propsFactory({
indeterminate: Boolean,
label: String,
description: String,
baseColor: String,
trueValue: null,
falseValue: null,
Expand Down Expand Up @@ -318,10 +320,23 @@ export const VSelectionControl = genericComponent<new <T>(
</div>
</div>

{ label && (
<VLabel for={ id.value } onClick={ onClickLabel }>
{ label }
</VLabel>
{ (label || props.description || slots.description) && (
<div class="v-selection-control__label-wrapper">
{ label && (
<VLabel key={ id.value } for={ id.value } onClick={ onClickLabel }>
{ label }
</VLabel>
)}

{ (props.description || slots.description) && (
<div class="v-selection-control__description">
{ slots.description
? slots.description({ description: props.description })
: props.description
}
</div>
)}
</div>
)}
</div>
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,5 @@ $selection-control-error-color: rgb(var(--v-theme-error)) !default;
$selection-control-density: ('default': 0, 'comfortable': -1, 'compact': -3) !default;
$selection-control-color: tools.theme-color('on-surface', var(--v-high-emphasis-opacity)) !default;
$selection-control-size: 40px !default;
$selection-control-description-font-size: 0.8125rem !default;
$selection-control-description-color: rgba(var(--v-theme-on-surface), var(--v-medium-emphasis-opacity)) !default;
Loading