Skip to content

How to add additional custom ContentSlots #52

Answered by OutlawAndy
igorkasyanchuk asked this question in Q&A
Discussion options

You must be logged in to vote

Hey @igorkasyanchuk!

You can do this using contentSlots. I realize the documentation could use some examples in this area, but it works like this:

You'll need to pass a config object into the start function:

import '@hotwired/turbo-rails'
import TC from '@rolemodel/turbo-confirm'

TC.start({
  contentSlots: {
    body: {
      contentAttribute: 'confirm-details',
      slotSelector: '#confirm-body'
    },
    acceptText: {
      contentAttribute: 'confirm-button',
      slotSelector: '#confirm-accept'
    },
    rejectText: {
      contentAttribute: 'confirm-cancel',
      slotSelector: '#confirm-cancel'
    }
  }
})

body & acceptText are already defined by default, but they'll be overrid…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by OutlawAndy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #51 on April 26, 2025 17:05.