Skip to main content

Story View

Layout

The Story View supports two layout modes that can be configured using the layout parameter.

Modern Layout

Story View Modern Layout

To use the modern layout, set the parameter as follows:

appearanceManager.setStoryReaderOptions({
layout: StoryReaderLayout.Modern,
});

Classic Layout

Story View Classic Layout

To use the classic layout, set the parameter as follows:

appearanceManager.setStoryReaderOptions({
layout: StoryReaderLayout.Classic,
});

Customization

Below are the configuration options for customizing the Story View appearance.

Common options

Common settings of the modal window for viewing story (close button, loader)

VariableTypeDescription
closeButtonPositionstringClose button position, one of start, end (for all readers).
closeButtonobjectClose button svg icon. (for all readers)
loader.default.colorstringDefault loader primary color. Valid css color. Default - white (for all readers)
loader.default.accentColorstringDefault loader accent color. Valid css color. Default - transparent (for all readers)
appearanceManager.setCommonOptions({
closeButton: {
svgSrc: {
baseState: "<svg>...</svg>"
};
}
})

Options

ParameterTypeDescription
closeButtonPositionstringPosition of the close button. Possible values: start, end. Values left and right are marked as deprecated since version 2.14.0.
scrollStylestringScroll style of the story view pager. Possible values: flat, cover, cube.
loader.default.colorstringPrimary loader color. Any valid CSS color. Default: white.
loader.default.accentColorstringLoader accent color. Any valid CSS color. Default: transparent.
sharePanelobjectShare panel options.
commonBackdropobjectBackdrop options for the StoryReader.
slideBackdropobjectBackdrop options for story slides.
timelineBlockTopOffsetnumber | undefinedTop offset (in px) of the timeline block. Default: 5. Expands the backdrop below the block as well.
actionPanelBottomOffsetnumber | undefinedBottom offset (in px) of the ActionPanel. Default: 0. Also increases ActionPanel height.
closeButtonobjectOverride close button SVG icon.
likeButtonobjectOverride like button SVG icon.
dislikeButtonobjectOverride dislike button SVG icon.
favoriteButtonobjectOverride favorite button SVG icon.
muteButtonobjectOverride mute button SVG icon.
shareButtonobjectOverride share button SVG icon.
navigationobjectOverride navigation buttons SVG icons.
borderRadiusnumberBorder radius of stories in px. Default: 5.
layoutstringStory view layout. Possible values: modern, classic. Default: classic.

Story backdrop options

Configuration for the common backdrop.

ParameterTypeDescription
colorstringBackdrop color. Any valid CSS color. Example: rgba(0,0,0,.3). Default: rgba(0,0,0,1).
backdropFilterstring | nullCSS filter for the backdrop. Example: blur(10px). Default: null.

Story slide backdrop options

VariableTypeDescription
opacitynumberSlide based image backdrop - opacity value. Default .56
blurnumberSlide based image backdrop - blur value. Default 30
linearGradientOverlayArray<string>Slide based image backdrop - Linear gradient overlay values. Default [rgba(0, 0, 0, 0.1) 0%, rgba(0, 0, 0, 0.9) 100%]

Story navigation options

VariableTypeDescription
svgSrcobjectSvg button sources for different states. Button touchable size is 32x32px. You can use the icon up to these sizes.
prevButton.svgSrc.baseStatestring<svg>...</svg>
nextButton.svgSrc.baseStatestring<svg>...</svg>

Examples

Copy of default config

appearanceManager.setStoryReaderOptions({
commonBackdrop: {
color: 'rgba(51, 51, 51, 1)',
backdropFilter: null,
},
slideBackdrop: {
opacity: 0.56,
blur: 30,
linearGradientOverlay: ['rgba(0, 0, 0, 0.1) 0%', 'rgba(0, 0, 0, 0.9) 100%'],
},
});

Translucent config without slide based backdrop image

appearanceManager.setStoryReaderOptions({
commonBackdrop: {
color: 'rgba(51, 51, 51, .8)',
backdropFilter: null,
},
slideBackdrop: {
opacity: 0,
blur: 30,
linearGradientOverlay: ['rgba(0, 0, 0, 0.1) 0%', 'rgba(0, 0, 0, 0.9) 100%'],
},
});

Translucent config without slide based backdrop image and parent screen blur effect

appearanceManager.setStoryReaderOptions({
commonBackdrop: {
color: 'rgba(51, 51, 51, .2)',
backdropFilter: 'blur(5px)',
},
slideBackdrop: {
opacity: 0,
blur: 30,
linearGradientOverlay: ['rgba(0, 0, 0, 0.1) 0%', 'rgba(0, 0, 0, 0.9) 100%'],
},
});

Action Bar

The Action Bar is a key UI element that provides quick access to core interactive features. It consists of a set of intuitive icons, each responsible for a specific action.

Actions

  • Like / Dislike

    Allows the user to express positive or negative feedback about the content.

  • Add to Favorites / Remove from Favorites

    Adds the content to a Favorites list for quick future access or removes it from the list.

  • Share

    Opens a sharing panel:

    • Desktop: bottom sheet,
    • Mobile: system share menu.
  • Mute / Unmute

    Controls media playback sound (video, audio, ads). Allows enabling or disabling sound instantly without interrupting playback.

Options

You can enable/disable controls using appearanceManager.setCommonOptions() method

appearanceManager.setCommonOptions({
hasLike: true,
hasFavorite: true,
hasShare: true,
});
ParameterTypeDescription
hasLikebooleanEnables the Like / Dislike action. Default false
hasFavoritebooleanEnables the Add to Favorites action. Default false
hasSharebooleanEnables the Share action. Default false

StoryReader customization

  • Customize like or dislike button icon
appearanceManager.setStoryReaderOptions({
likeButton: {
svgSrc: {
baseState: '<svg>...</svg>',
},
},
dislikeButton: {
svgSrc: {
baseState: '<svg>...</svg>',
},
},
});
  • Customize favorite button icon
appearanceManager.setStoryReaderOptions({
favoriteButton: {
svgSrc: {
baseState: '<svg>...</svg>',
},
},
});
  • Customize share button icon
appearanceManager.setStoryReaderOptions({
shareButton: {
svgSrc: {
baseState: '<svg>...</svg>',
},
},
});
  • Customize action bar position
appearanceManager.setStoryReaderOptions({
actionPanelBottomOffset: 20,
});

Events

import { InAppStoryManager } from '@inappstory/js-sdk';

const inAppStoryManager = new InAppStoryManager({ apiKey: '{projectToken}' });
inAppStoryManager.on('clickOnStory', (payload) => console.log(payload));


showStory

Description: Triggered when a story is opened (from slider or reader).

Payload:

FieldTypeDescription
idnumberStory ID.
titlestring?Story title.
slidesCountnumber?Number of slides in the story.
feedstring?Feed name where the story belongs.
sourcestring?Story source.
filterobjectApplied filters.
ugcPayloadobjectUGC-related payload.
defaultListLengthnumberDefault list length.
favoriteListLengthnumberFavorite list length.

closeStory

Description: Triggered when a story is closed.

Payload:

FieldTypeDescription
idnumberStory ID.
titlestring?Story title.
slidesCountnumber?Number of slides in the story.
feedstring?Feed name where the story belongs.
sourcestring?Story source.
filterobjectApplied filters.
ugcPayloadobjectUGC-related payload.
defaultListLengthnumberDefault list length.
favoriteListLengthnumberFavorite list length.
actionstringClose action (closeReaderByCloseBtn, closeReaderByEscBtn, swipeDown, swipe, lastSlideClick, auto, externalCloseReader).

showSlide

Description: Triggered when a slide is shown.

Payload:

FieldTypeDescription
idnumberStory ID.
titlestring?Story title.
slidesCountnumber?Number of slides in the story.
feedstring?Feed name where the story belongs.
sourcestring?Story source.
filterobjectApplied filters.
ugcPayloadobjectUGC-related payload.
defaultListLengthnumberDefault list length.
favoriteListLengthnumberFavorite list length.
indexnumberSlide index.
payloadstringSlide payload.

likeStory

Description: Triggered when a user likes/unlikes a story.

Payload:

FieldTypeDescription
idnumberStory ID.
titlestring?Story title.
slidesCountnumber?Number of slides in the story.
feedstring?Feed name where the story belongs.
sourcestring?Story source.
filterobjectApplied filters.
ugcPayloadobjectUGC-related payload.
defaultListLengthnumberDefault list length.
favoriteListLengthnumberFavorite list length.
valuebooleantrue if liked, false if unliked.

dislikeStory

Description: Triggered when a user dislikes/undislikes a story.

Payload:

FieldTypeDescription
idnumberStory ID.
titlestring?Story title.
slidesCountnumber?Number of slides in the story.
feedstring?Feed name where the story belongs.
sourcestring?Story source.
filterobjectApplied filters.
ugcPayloadobjectUGC-related payload.
defaultListLengthnumberDefault list length.
favoriteListLengthnumberFavorite list length.
valuebooleantrue if disliked, false if removed.

favoriteStory

Description: Triggered when a user adds/removes a story to favorites.

Payload:

FieldTypeDescription
idnumberStory ID.
titlestring?Story title.
slidesCountnumber?Number of slides in the story.
feedstring?Feed name where the story belongs.
sourcestring?Story source.
filterobjectApplied filters.
ugcPayloadobjectUGC-related payload.
defaultListLengthnumberDefault list length.
favoriteListLengthnumberFavorite list length.
valuebooleantrue if favorited, false if removed.

shareStory

Description: Triggered when a user clicks on story sharing.

Payload:

FieldTypeDescription
idnumberStory ID.
titlestring?Story title.
slidesCountnumber?Number of slides in the story.
feedstring?Feed name where the story belongs.
sourcestring?Story source.
filterobjectApplied filters.
ugcPayloadobjectUGC-related payload.
defaultListLengthnumberDefault list length.
favoriteListLengthnumberFavorite list length.

shareStoryWithPath

Description: Triggered after successful creation of the sharing path.

Payload:

FieldTypeDescription
idnumberStory ID.
titlestring?Story title.
slidesCountnumber?Number of slides in the story.
feedstring?Feed name where the story belongs.
sourcestring?Story source.
filterobjectApplied filters.
ugcPayloadobjectUGC-related payload.
defaultListLengthnumberDefault list length.
favoriteListLengthnumberFavorite list length.
urlstringGenerated sharing URL.

widgetEvent

Description: Triggered by widgets inside a story.

Payload:

FieldTypeDescription
namestringWidget name.
dataanyWidget-specific data.