Skip to content

Commit aca7d30

Browse files
authored
feat(VOtpInput): add density prop (#22401)
1 parent 4fcb72c commit aca7d30

4 files changed

Lines changed: 16 additions & 2 deletions

File tree

packages/docs/src/data/new-in.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,11 @@
239239
"autocomplete": "3.10.0"
240240
}
241241
},
242+
"VOtpInput": {
243+
"props": {
244+
"density": "3.12.0"
245+
}
246+
},
242247
"VOverlay": {
243248
"props": {
244249
"captureFocus": "3.11.0",

packages/vuetify/src/components/VOtpInput/VOtpInput.sass

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Imports
1+
@use 'sass:math';
22
@use '../../styles/settings'
33
@use '../../styles/tools'
44
@use './variables' as *
@@ -27,7 +27,6 @@
2727
align-items: center
2828
display: flex
2929
gap: $otp-input-content-gap
30-
height: $otp-input-content-height
3130
padding: $otp-input-content-padding
3231
justify-content: center
3332
max-width: $otp-input-content-max-width
@@ -37,6 +36,11 @@
3736
.v-otp-input--divided &
3837
max-width: $otp-input-divided-content-max-width
3938

39+
@at-root
40+
@include tools.density('v-otp-input', $input-density) using ($modifier)
41+
.v-otp-input__content
42+
height: #{$otp-input-content-height + math.div($modifier, 2)}
43+
4044
.v-otp-input__field
4145
color: inherit
4246
font-size: $otp-input-field-font-size

packages/vuetify/src/components/VOtpInput/VOtpInput.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import { VProgressCircular } from '@/components/VProgressCircular/VProgressCircu
88

99
// Composables
1010
import { provideDefaults } from '@/composables/defaults'
11+
import { makeDensityProps, useDensity } from '@/composables/density'
1112
import { makeDimensionProps, useDimension } from '@/composables/dimensions'
1213
import { makeFocusProps, useFocus } from '@/composables/focus'
1314
import { useIntersectionObserver } from '@/composables/intersectionObserver'
@@ -50,6 +51,7 @@ export const makeVOtpInputProps = propsFactory({
5051
default: 'number',
5152
},
5253

54+
...makeDensityProps(),
5355
...makeDimensionProps(),
5456
...makeFocusProps(),
5557
...pick(makeVFieldProps({
@@ -81,6 +83,7 @@ export const VOtpInput = genericComponent<VOtpInputSlots>()({
8183
},
8284

8385
setup (props, { attrs, emit, slots }) {
86+
const { densityClasses } = useDensity(props)
8487
const { dimensionStyles } = useDimension(props)
8588
const { isFocused, focus, blur } = useFocus(props)
8689
const model = useProxiedModel(
@@ -257,6 +260,7 @@ export const VOtpInput = genericComponent<VOtpInputSlots>()({
257260
{
258261
'v-otp-input--divided': !!props.divider,
259262
},
263+
densityClasses.value,
260264
props.class,
261265
]}
262266
style={[

packages/vuetify/src/components/VOtpInput/_variables.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
@forward '../VInput/variables';
12
@use '../../styles/settings';
23
@use '../../styles/tools';
34

0 commit comments

Comments
 (0)