Skip to content

Slideout for custom content #11711

Answered by brandonkelly
markhuot asked this question in Q&A
Discussion options

You must be logged in to vote

Working with slideouts (Craft.Slideout) is pretty similar to working with modals (Garnish.Modal). Here’s an example of how the Field Layout Designer creates them for its layout component settings in Craft 4:

const slideout = new Craft.Slideout($contents, {
containerElement: 'form',
containerAttributes: {
action: '',
method: 'post',
novalidate: '',
class: 'fld-element-settings',
},
});
slideout.on('open', () => {
// Hold off a sec until it's positioned...
Garnish.requestAnimationFrame(() => {
// Focus on the first text input
slideout.$…

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@markhuot
Comment options

Answer selected by brandonkelly
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants