Skip to content

Commit 6fda689

Browse files
committed
feat: (otp-input) Add props to control background color.
1 parent 85f7e08 commit 6fda689

File tree

3 files changed

+19
-1
lines changed

3 files changed

+19
-1
lines changed

packages/otp-input/src/components/otp-input.vue

+3-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@
1111
'--ci-border-radius': rounded || borderRadius ? borderRadius ?? '5px' : undefined,
1212
'--ci-color-primary': primaryColor,
1313
'--ci-color-secondary': secondaryColor,
14-
'--ci-text-color-active': textColorActive ?? secondaryColor
14+
'--ci-text-color-active': textColorActive ?? secondaryColor,
15+
'--ci-background': backgroundColor,
16+
'--ci-background-active': backgroundColorActive
1517
}"
1618
>
1719
<slot>

packages/otp-input/src/styles/main.scss

+4
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
--ci-text-color: var(--ci-color-primary);
1010
--ci-font-size: 30px;
1111
--ci-font-family: 'Anton', sans-serif;
12+
--ci-background: transparent;
13+
--ci-background-active: transparent;
1214
--ci-gap: 10px;
1315
&.disabled {
1416
opacity: 0.5;
@@ -79,10 +81,12 @@
7981
box-sizing: border-box;
8082
appearance: initial;
8183
-webkit-appearance: initial;
84+
background-color: var(--ci-background);
8285
&:focus {
8386
outline: none;
8487
color: var(--ci-text-color-active);
8588
caret-color: var(--ci-text-color-active);
89+
background-color: var(--ci-background-active);
8690
}
8791
}
8892
&.border-b {

packages/otp-input/types.ts

+12
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,18 @@ export interface OtpInputType {
7070
* @default #000
7171
*/
7272
textColorActive?: string | undefined
73+
/**
74+
* Sets the background color for the input boxes
75+
*
76+
* @default transparent
77+
*/
78+
backgroundColor?: string | undefined
79+
/**
80+
* Sets the background color for the focused input box
81+
*
82+
* @default transparent
83+
*/
84+
backgroundColorActive?: string | undefined
7385
/**
7486
* The position of the component
7587
* [

0 commit comments

Comments
 (0)