shadow Contentコンポーネントは、スクロール可能領域を制御するいくつかの便利なメソッドを備えた、
使いやすいコンテンツ領域を提供します。
1つのビューに表示できるコンテンツは1つだけです。
Contentは、他の多くのIonicコンポーネントと同様に、 CSS Utilities で提供されるグローバルスタイルを使用するか、CSSおよび使用可能な CSS Custom Properties を使用して個別にスタイル設定することによって、padding
や margin
などを変更するようにカスタマイズできます。
コンテンツは、ページ内の唯一のトップレベル・コンポーネントとすることも、ヘッダー 、フッター 、またはその両方と一緒に使用することも可能です。ヘッダーやフッターと一緒に使用すると、残りの高さを埋めるようにサイズが調整されます。
Fullscreen Content デフォルトでは、コンテンツは ヘッダー と フッター の間のスペースを埋めますが、それらの背景にまわることはありません。例えば、ヘッダーとフッターのどちらかに translucent
プロパティを設定した場合や、ツールバーに opacity
を設定した場合など、特定のケースでは、コンテンツをヘッダーとフッターの後ろにスクロールさせることが望まれるかもしれない。これは、コンテンツの fullscreen
プロパティを true
に設定することで実現することができます。
スクロール可能な領域の外側に要素を配置するには、fixed
スロットに割り当てます。そうすることで、その要素はコンテンツの左上に絶対位置 されます。要素の位置を変えるには、CSSのtop, right, bottom, left プロパティを使ってスタイルを設定することができます。
コンテンツには メソッド が用意されており、これを呼び出すことでコンテンツを下、上、または特定のポイントにスクロールさせることができます。これらのメソッドには duration
を渡すことができ、瞬時に位置を変更するのではなく、スムーズに移行することができます。
スクロールイベントは、パフォーマンス上、コンテンツに対してデフォルトで無効化されています。しかし、scrollEvents
を true
に設定することで、有効にすることができます。これは、 スクロール イベント を聞く前に必要です。
interface ScrollBaseDetail { isScrolling : boolean ; }
Copy interface ScrollDetail extends GestureDetail , ScrollBaseDetail { scrollTop : number ; scrollLeft : number ; }
Copy 必須ではありませんが、ionScrollStart
と ionScrollEnd
イベントをより強く型付けするために、CustomEvent
インターフェースの代わりにこのインターフェースを利用することが可能です。
interface ScrollBaseCustomEvent extends CustomEvent { detail : ScrollBaseDetail ; target : HTMLIonContentElement ; }
Copy 必須ではありませんが、ionScroll
イベントをより強く型付けするために、CustomEvent
インターフェースの代わりにこのインターフェースを利用することが可能です。
interface ScrollCustomEvent extends ScrollBaseCustomEvent { detail : ScrollDetail ; }
Copy Description The color to use from your application's color palette. Default options are: "primary"
, "secondary"
, "tertiary"
, "success"
, "warning"
, "danger"
, "light"
, "medium"
, and "dark"
. For more information on colors, see theming . Attribute color
Type "danger" | "dark" | "light" | "medium" | "primary" | "secondary" | "success" | "tertiary" | "warning" | string & Record<never, never> | undefined
Default undefined
Description If true
and the content does not cause an overflow scroll, the scroll interaction will cause a bounce. If the content exceeds the bounds of ionContent, nothing will change. Note, the does not disable the system bounce on iOS. That is an OS level setting. Attribute force-overscroll
Type boolean | undefined
Default undefined
Description If true
, the content will scroll behind the headers and footers. This effect can easily be seen by setting the toolbar to transparent. Attribute fullscreen
Type boolean
Default false
Description Because of performance reasons, ionScroll events are disabled by default, in order to enable them and start listening from (ionScroll), set this property to true
. Attribute scroll-events
Type boolean
Default false
Description X軸方向のコンテンツスクロールを有効にしたい場合は、このプロパティをtrue
に設定します。 Attribute scroll-x
Type boolean
Default false
Description Y軸方向のコンテンツスクロールを無効にしたい場合は、このプロパティにfalse
を設定します。 Attribute scroll-y
Type boolean
Default true
Name Description ionScroll
Emitted while scrolling. This event is disabled by default. Set scrollEvents
to true
to enable. ionScrollEnd
Emitted when the scroll has ended. This event is disabled by default. Set scrollEvents
to true
to enable. ionScrollStart
Emitted when the scroll has started. This event is disabled by default. Set scrollEvents
to true
to enable.
Description Get the element where the actual scrolling takes place. This element can be used to subscribe to scroll
events or manually modify scrollTop
. However, it's recommended to use the API provided by ion-content
: i.e. Using ionScroll
, ionScrollStart
, ionScrollEnd
for scrolling events and scrollToPoint()
to scroll the content into a certain point. Signature getScrollElement() => Promise<HTMLElement>
Description コンポーネントを指定したX/Y距離だけスクロールさせる。 Signature scrollByPoint(x: number, y: number, duration: number) => Promise<void>
Description コンポーネントの一番下までスクロールします。 Signature scrollToBottom(duration?: number) => Promise<void>
Description コンポーネント内の指定したX/Y位置までスクロールします。 Signature scrollToPoint(x: number | undefined | null, y: number | undefined | null, duration?: number) => Promise<void>
Description コンポーネントの上部にスクロールします。 Signature scrollToTop(duration?: number) => Promise<void>
Name Description background
コンテンツの背景です。 scroll
コンテンツのスクロール可能なコンテナ。
Name Description --background
コンテンツの背景 --color
コンテンツの色 --keyboard-offset
コンテンツのキーボードオフセット --offset-bottom
コンテンツのオフセットボトム --offset-top
コンテンツのオフセットトップ --padding-bottom
コンテンツのBottom Padding --padding-end
コンテンツの方向が左から右の場合はRight Padding、右から左の場合はLeft Paddingとなります。 --padding-start
コンテンツの方向が左から右の場合はLeft Padding、右から左の場合はRight Paddingとなります。 --padding-top
コンテンツのTop Padding
Name Description `` slotなしで提供される場合、コンテンツはスクロール可能な領域に配置されます。 fixed
スクロールしてはいけない固定コンテンツに使用する必要があります。