Tabs are an important navigation element on many widgets. This tutorial shows you how to customize tab styling, icons, alignment, and behavior to match your design requirements.
This tutorial is for developers and integrators who have already integrated Sportradar widgets into their website and want to customize the appearance and behavior of tab components. You should be familiar with:
By completing this tutorial, you will learn how to:
To complete this tutorial, you will need:
Tab customization is performed through the branding configuration object when adding a widget with the SIR function.
Widget tabs are configured through the branding object when adding a widget. Tab customization happens in two namespaces:
branding.tabsbranding.namespaces.avTabSwitcher.tabsSIR('addWidget', '#container', 'match.preview', {
matchId: 12345,
branding: {
tabs: {
// Global tab settings apply here
option: 'iconText',
variant: 'standard'
},
namespaces: {
avTabSwitcher: {
tabs:
The following configuration options control tab appearance and behavior. All settings are applied within the branding.tabs or branding.namespaces.avTabSwitcher.tabs object.
When useClientTheming is enabled (set to true), default styling is removed and specific CSS classes are applied for custom styling. This gives you complete control over tab appearance.
/* Basic tab styling */
.sr-bb .srct-tab {
background-color: #f5f5f5;
color: #333;
}
/* Active tab styling */
.sr-bb .srct-tab--active {
background-color: #ffffff;
color: #1d4ed8;
}
/* Tab indicator styling */
.sr-bb
All widget styles must be scoped within the .sr-bb container class to ensure proper isolation and prevent conflicts with your site's CSS.
Different widgets use different sets of tabs. Below is a reference of which tab IDs are available for each widget type.
Available Tabs: statistics, detailedStatistics, headToHead, standings, timeline, lineups, boxscore, probabilities, pointByPoint, scorecard, leaderboard, avStream
Pitch Visualization Tabs (when layout: 'single' is set):
pitchBadminton, pitchBaseball, pitchBasketball, pitchBeachVolleyball, pitchCricket, pitchDarts, pitchFutsal, pitchHandball, pitchHockey, pitchAmericanFootball, pitchRugby, pitchSnooker, pitchSoccer, pitchSquash, pitchTableTennis, pitchTennis, pitchVolleyball
Available Tabs: matchInfo, leaders, lineups, standings, teamStats, leaderboard, playerProfile, ranking
Available Tabs: overview, leaders, results, standings, teams
Available Tabs: headToHead, form, teamStats, teamstatsmatch, lastMatches
This example demonstrates how to customize tabs for a Match Preview widget with custom styling, icons, and configuration.
Create your HTML file with the widget container and necessary styling:
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Match Preview Tabs Configuration</title>
<style>
.
Add the widget loader script and configuration:
<script>
(function (a, b, c,
matchId: 12345 with an actual match IDDisplay Options:
option: 'iconText' - Shows both icons and text labelsiconPosition: 'start' - Places icons before textLayout Options:
variant: 'standard' - Tabs use minimum width (not full width)align: 'end' - Tabs are right-alignedStyling:
useClientTheming: true - Enables custom CSS classes (.srct-*)Custom Icons:
icons.avStream - Provides custom icon URL for the stream tabFor a minimal, icon-only interface:
SIR('addWidget', '#container', 'match.preview', {
matchId: 12345,
branding: {
tabs: {
option: 'icon', // Show only icons
variant: 'fullWidth' // Expand to full width
}
}
});For a text-focused design:
SIR('addWidget', '#container', 'match.preview', {
matchId: 12345,
branding: {
tabs: {
option: 'text', // Show only text
variant: 'standard',
align: 'center' // Center the tabs
}
}
});Replace default icons with your own:
SIR('addWidget', '#container', 'match.preview', {
matchId: 12345,
branding: {
namespaces: {
avTabSwitcher: {
tabs: {
option: 'iconText',
icons: {
"matchInfo": "/path/to/info-icon.svg",
"lineups"
| Property | Type | Options | Description |
|---|---|---|---|
option | string | iconText, icon, text | Controls what content appears in tabs: • iconText - Display both icon and text• icon - Display only icons• text - Display only text labels |
variant | string | fullWidth, standard | Controls horizontal space usage: • fullWidth - Tabs expand to fill available width• standard - Tabs use minimum required width |
align | string | start, center, end | Horizontal alignment when variant is standard:• start - Left-aligned• center - Center-aligned• end - Right-aligned |
iconPosition | string | start, end | Icon placement when option is iconText:• start - Icon before text• end - Icon after text |
icons | object | Tab ID to URL mapping | Custom icon paths for specific tabs. See Available Tabs for tab IDs |
arrowIcon | string | Image URL | Path to custom arrow/indicator icon file |
useClientTheming | boolean | true, false | When true, removes default styling and applies .srct- CSS classes for custom styling. See CSS Classes |
Use useClientTheming: true when you want complete control over tab styling with your own CSS. This disables default theme styles and applies classes prefixed with .srct- for easier customization.
| CSS Class | Applied To | Description |
|---|---|---|
.srct-tabs | Tabs container | Wrapper element containing all tabs |
.srct-tab | Individual tab | Each tab element |
.srct-tab__content | Tab content wrapper | Container for icon, text, and indicator |
.srct-tab--active | Active tab | Applied to the currently selected tab |
.srct-tab__indicator | Tab indicator | Visual indicator element (typically underline) |
.srct-tab__indicator--active | Active indicator | Indicator of the active tab |
.srct-tab__arrow | Arrow element | Navigation arrow icon |
.srct-tab__text-label | Text label | Tab text content |
.srct-tab__icon | Icon element | Tab icon image |
| Tab ID | Matching Icon |
|---|---|
| statistics / teamStats | |
| headToHead | |
| standings | |
| timeline / plays | |
| lineups / roster | |
| boxScore / scorecard | |
| overview / matchInfo | |
| cup / playoffs | |
| form | |
| teams | |
| leaders | |
| leaderboard | |
| facts | |
| ranking | |
| pointByPoint | |
| probabilities | |
| results / lastMeetings / lastMatches | |
| playerProfile | |
| pitchDarts | |
| pitchAmericanFootball | |
| pitchBadminton | |
| pitchBaseball | |
| pitchBasketball | |
| pitchBeachVolleyball | |
| pitchFutsal | |
| pitchHandball | |
| pitchHockey | |
| pitchRugby | |
| pitchSnooker | |
| pitchTableTennis | |
| pitchTennis | |
| pitchVolleyball | |
| pitchSquash | |
| pitchSoccer | |
| avStream |
Start with a simple configuration and add customizations incrementally. Test after each change to ensure everything works as expected.