@@ -7,6 +7,7 @@ import { CFormText } from './CFormText'
7
7
import type { ComponentProps } from '../../utils/ComponentProps'
8
8
9
9
interface CFormControlWrapperProps extends ComponentProps < typeof CFormControlValidation > {
10
+ floatingClassName ?: string
10
11
floatingLabel ?: string
11
12
id ?: string
12
13
label ?: string
@@ -18,6 +19,12 @@ const CFormControlWrapper = defineComponent({
18
19
inheritAttrs : false ,
19
20
props : {
20
21
...CFormControlValidation . props ,
22
+ /**
23
+ * A string of all className you want applied to the floating label wrapper.
24
+ *
25
+ * @since 5.5.0
26
+ */
27
+ floatingClassName : String ,
21
28
/**
22
29
* Provide valuable, actionable valid feedback when using standard HTML form validation which applied two CSS pseudo-classes, `:invalid` and `:valid`.
23
30
*
@@ -69,29 +76,36 @@ const CFormControlWrapper = defineComponent({
69
76
70
77
return ( ) =>
71
78
props . floatingLabel
72
- ? h ( CFormFloating , ( ) => [
73
- slots . default && slots . default ( ) ,
74
- h (
75
- CFormLabel ,
76
- {
77
- for : props . id ,
78
- } ,
79
- {
80
- default : ( ) => ( slots . label && slots . label ( ) ) || props . label || props . floatingLabel ,
81
- } ,
82
- ) ,
83
- ( props . text || slots . text ) &&
79
+ ? h (
80
+ CFormFloating ,
81
+ {
82
+ class : props . floatingClassName ,
83
+ } ,
84
+ ( ) => [
85
+ slots . default && slots . default ( ) ,
84
86
h (
85
- CFormText ,
87
+ CFormLabel ,
86
88
{
87
- id : props . describedby ,
89
+ for : props . id ,
88
90
} ,
89
91
{
90
- default : ( ) => ( slots . text && slots . text ( ) ) || props . text ,
92
+ default : ( ) =>
93
+ ( slots . label && slots . label ( ) ) || props . label || props . floatingLabel ,
91
94
} ,
92
95
) ,
93
- formControlValidation ( ) ,
94
- ] )
96
+ ( props . text || slots . text ) &&
97
+ h (
98
+ CFormText ,
99
+ {
100
+ id : props . describedby ,
101
+ } ,
102
+ {
103
+ default : ( ) => ( slots . text && slots . text ( ) ) || props . text ,
104
+ } ,
105
+ ) ,
106
+ formControlValidation ( ) ,
107
+ ] ,
108
+ )
95
109
: [
96
110
( props . label || slots . label ) &&
97
111
h (
0 commit comments