File tree Expand file tree Collapse file tree 2 files changed +51
-1
lines changed
src/components/DsfrAccordion Expand file tree Collapse file tree 2 files changed +51
-1
lines changed Original file line number Diff line number Diff line change @@ -122,3 +122,50 @@ AccordeonDansUnAccordeon.args = {
122122 title : 'Un titre d’accordéon' ,
123123 titleSub : 'Accordéon dans l’accordéon' ,
124124}
125+
126+ export const AccordeonTitreCustom = ( args ) => ( {
127+ components : {
128+ DsfrAccordion,
129+ DsfrAccordionsGroup
130+ } ,
131+
132+ data ( ) {
133+ return {
134+ ...args ,
135+ title1 : args . title1 ,
136+ title2 : args . title2 ,
137+ expandedId : undefined ,
138+ }
139+ } ,
140+
141+ template : `
142+ <DsfrAccordionsGroup>
143+ <li>
144+ <DsfrAccordion
145+ :expanded-id="expandedId"
146+ @expand="expandedId = $event"
147+ >
148+ <template #title><h1>{{title1}}</h1></template>
149+ </DsfrAccordion>
150+ </li>
151+ <li>
152+ <DsfrAccordion
153+ :title="title2"
154+ :expanded-id="expandedId"
155+ @expand="expandedId = $event"
156+ >
157+ </DsfrAccordion>
158+ </li>
159+ </DsfrAccordionsGroup>
160+ ` ,
161+
162+ mounted ( ) {
163+ document . body . parentElement . setAttribute ( 'data-fr-theme' , this . dark ? 'dark' : 'light' )
164+ } ,
165+
166+ } )
167+ AccordeonTitreCustom . args = {
168+ dark : false ,
169+ title1 : 'Un titre d’accordéon customisé' ,
170+ title2 : 'Un autre titre d’accordéon'
171+ }
Original file line number Diff line number Diff line change @@ -51,7 +51,10 @@ export default defineComponent({
5151 :aria-controls =" id"
5252 @click =" toggleExpanded()"
5353 >
54- <span >{{ title }}</span >
54+ <!-- @slot Slot pour le contenu personnalisé du titre de l’accordéon. Une props du même nom est utilisable pour du texte simple sans mise en forme. -->
55+ <slot name =" title" >
56+ <span >{{ title }}</span >
57+ </slot >
5558 </button >
5659 </h3 >
5760 <div
You can’t perform that action at this time.
0 commit comments