docs(content): add information on fixed slots (#20324)

closes ionic-team/ionic-docs#731
This commit is contained in:
Brandy Carney
2020-01-29 10:40:33 -05:00
committed by GitHub
parent ae4e28969f
commit 7877ea03fe
5 changed files with 50 additions and 2 deletions

View File

@ -6,6 +6,12 @@ view.
Content, along with many other Ionic components, can be customized to modify its padding, margin, and more using the global styles provided in the [CSS Utilities](/docs/layout/css-utilities) or by individually styling it using CSS and the available [CSS Custom Properties](#css-custom-properties). Content, along with many other Ionic components, can be customized to modify its padding, margin, and more using the global styles provided in the [CSS Utilities](/docs/layout/css-utilities) or by individually styling it using CSS and the available [CSS Custom Properties](#css-custom-properties).
## Fixed Content
In order to place elements outside of the scrollable area, `slot="fixed"` can be added to the element. This will absolutely position the element placing it in the top left. In order to place the element in a different position, style it using [top, right, bottom, and left](https://developer.mozilla.org/en-US/docs/Web/CSS/position).
<!-- Auto Generated Below --> <!-- Auto Generated Below -->
@ -19,6 +25,11 @@ Content, along with many other Ionic components, can be customized to modify its
(ionScrollStart)="logScrollStart()" (ionScrollStart)="logScrollStart()"
(ionScroll)="logScrolling($event)" (ionScroll)="logScrolling($event)"
(ionScrollEnd)="logScrollEnd()"> (ionScrollEnd)="logScrollEnd()">
<h1>Main Content</h1>
<div slot="fixed">
<h1>Fixed Content</h1>
</div>
</ion-content> </ion-content>
``` ```
@ -26,7 +37,13 @@ Content, along with many other Ionic components, can be customized to modify its
### Javascript ### Javascript
```html ```html
<ion-content></ion-content> <ion-content>
<h1>Main Content</h1>
<div slot="fixed">
<h1>Fixed Content</h1>
</div>
</ion-content>
``` ```
```javascript ```javascript
@ -50,6 +67,11 @@ const ContentExample: React.FC = () => (
onIonScrollStart={() => {}} onIonScrollStart={() => {}}
onIonScroll={() => {}} onIonScroll={() => {}}
onIonScrollEnd={() => {}}> onIonScrollEnd={() => {}}>
<h1>Main Content</h1>
<div slot="fixed">
<h1>Fixed Content</h1>
</div>
</IonContent> </IonContent>
); );
``` ```
@ -64,6 +86,11 @@ const ContentExample: React.FC = () => (
@ionScrollStart="logScrollStart()" @ionScrollStart="logScrollStart()"
@ionScroll="logScrolling($event)" @ionScroll="logScrolling($event)"
@ionScrollEnd="logScrollEnd()"> @ionScrollEnd="logScrollEnd()">
<h1>Main Content</h1>
<div slot="fixed">
<h1>Fixed Content</h1>
</div>
</ion-content> </ion-content>
</template> </template>
``` ```

View File

@ -4,6 +4,11 @@
(ionScrollStart)="logScrollStart()" (ionScrollStart)="logScrollStart()"
(ionScroll)="logScrolling($event)" (ionScroll)="logScrolling($event)"
(ionScrollEnd)="logScrollEnd()"> (ionScrollEnd)="logScrollEnd()">
<h1>Main Content</h1>
<div slot="fixed">
<h1>Fixed Content</h1>
</div>
</ion-content> </ion-content>
``` ```

View File

@ -1,5 +1,11 @@
```html ```html
<ion-content></ion-content> <ion-content>
<h1>Main Content</h1>
<div slot="fixed">
<h1>Fixed Content</h1>
</div>
</ion-content>
``` ```
```javascript ```javascript

View File

@ -8,6 +8,11 @@ const ContentExample: React.FC = () => (
onIonScrollStart={() => {}} onIonScrollStart={() => {}}
onIonScroll={() => {}} onIonScroll={() => {}}
onIonScrollEnd={() => {}}> onIonScrollEnd={() => {}}>
<h1>Main Content</h1>
<div slot="fixed">
<h1>Fixed Content</h1>
</div>
</IonContent> </IonContent>
); );
``` ```

View File

@ -5,6 +5,11 @@
@ionScrollStart="logScrollStart()" @ionScrollStart="logScrollStart()"
@ionScroll="logScrolling($event)" @ionScroll="logScrolling($event)"
@ionScrollEnd="logScrollEnd()"> @ionScrollEnd="logScrollEnd()">
<h1>Main Content</h1>
<div slot="fixed">
<h1>Fixed Content</h1>
</div>
</ion-content> </ion-content>
</template> </template>
``` ```