--p-flyout-sticky-top
CSS custom property to account for the height of the header.Some sticky element within content relying on --p-flyout-sticky-top
<!doctype html>
<html lang="en" class="auto">
<head>
<title></title>
</head>
<body class="bg-base">
<p-button type="button" aria="{'aria-haspopup': 'dialog'}">
Open Flyout
</p-button>
<p-flyout aria="{'aria-label': 'Some Heading'}">
<p-heading slot="header" size="large" tag="h2">
Some Heading
</p-heading>
<div class="grid grid-cols-[2fr_1fr] gap-static-md items-start">
<div class="sticky top-[calc(var(--p-flyout-sticky-top,0)+16px)] p-static-md bg-surface">
Some sticky element within content relying on --p-flyout-sticky-top
</div>
<div>
<p-text>
Some Content Begin
</p-text>
<div class="w-[10px] h-[120vh] bg-[deeppink]"></div>
<p-text>
Some Content End
</p-text>
</div>
</div>
</p-flyout>
<script>
const pButton = document.querySelector("p-button");
const pFlyout = document.querySelector("p-flyout");
pButton.addEventListener('click', () => (pFlyout.open = true));
pFlyout.addEventListener('dismiss', () => (pFlyout.open = false));
</script>
</body>
</html>
checkbox: none
textarea: none
<!doctype html>
<html lang="en" class="auto">
<head>
<title></title>
</head>
<body class="bg-base">
<p-button type="button" aria="{ 'aria-haspopup': 'dialog' }">Open Flyout</p-button>
<p-flyout open="false" aria="{ 'aria-label': 'Some Heading' }">
<p-heading slot="header" size="large" tag="h2">Some Heading</p-heading>
<form id="some-form">
<p-checkbox name="some-checkbox" label="Some Label"></p-checkbox>
<p-textarea name="some-textarea" label="Some Label"></p-textarea>
</form>
<p-button-group slot="footer">
<p-button type="submit" form="some-form">Submit</p-button>
<p-button type="reset" variant="secondary" form="some-form">Reset</p-button>
</p-button-group>
<p-text slot="sub-footer">
Last submitted data:
<br/><br/>
checkbox: <span>none</span>
<br/>
textarea: <span>none</span>
</p-text>
</p-flyout>
<script>
const flyout = document.querySelector('p-flyout');
flyout.addEventListener('dismiss', () => (flyout.open = false));
document.querySelector('p-button').addEventListener('click', () => (flyout.open = true));
const debugElement = document.querySelectorAll('span');
const checkboxValue = debugElement[0];
const textareaValue = debugElement[1];
const form = document.querySelector('form');
form.addEventListener('submit', (e) => {
e.preventDefault();
const formData = new FormData(form);
checkboxValue.innerHTML = formData.get('some-checkbox')?.toString() || 'none';
textareaValue.innerHTML = formData.get('some-textarea')?.toString() || 'none';
});
</script>
</body>
</html>