> ## Documentation Index
> Fetch the complete documentation index at: https://www.propeldata.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Group By

> Break down data by dimensions.

<div />

Wrap with the [Filter Provider](/docs/embeddable-ui/components/filter-provider) to apply the selected group by to child components.

<Tabs>
  <Tab title="Preview">
    <iframe
      width="100%"
      height="350"
      src="https://ui-kit-docs-examples.vercel.app/group-by"
      allow="accelerometer; clipboard-write; gyroscope;"
      style={{
    overflow: 'hidden',
    border: '1px solid #ECECED',
  }}
      scrolling="no"
      marginWidth="0"
      marginHeight="0"
    />
  </Tab>

  <Tab title="Code">
    ```jsx /group-by/page.tsx theme={"system"}
    import {
      FilterProvider,
      Flex,
      GroupBy,
    } from "@propeldata/ui-kit";

    export default async function GroupByExample() {
      return (
          <Flex p="7" justify="center" width="100%">
            <FilterProvider>
              <GroupBy
                query={{
                  dataPool: { name: "TacoSoft Demo Data" }
                }}
                includeColumns={[
                  "taco_name",
                  "restaurant_name",
                  "sauce_name",
                  "tortilla_name"
                ]}
                prettifyColumnNames={true}
                defaultOpen
              />
          </FilterProvider>
        </Flex>
      );
    }
    ```
  </Tab>
</Tabs>

<div className="flex justify-center gap-8 mt-2">
  <a href="https://github.com/propeldata/ui-kit/blob/main/packages/ui-kit/src/components/GroupBy/GroupBy.tsx" target="_blank" className="flex items-center gap-2 text-xs">
    <Icon icon="github" size={18} />

    GitHub

    <Icon icon="arrow-up-right-from-square" size={12} />
  </a>

  <a href="https://storybook.propeldata.com" target="_blank" className="flex items-center gap-2 text-xs">
    <Icon icon="book" size={18} />

    Storybook

    <Icon icon="arrow-up-right-from-square" size={12} />
  </a>

  <a href="https://github.com/propeldata/ui-kit-docs-examples/blob/main/src/app/group-by/page.tsx" target="_blank" className="flex items-center gap-2 text-xs">
    <Icon icon="github" size={18} />

    Example

    <Icon icon="arrow-up-right-from-square" size={12} />
  </a>
</div>

## Props API

<ParamField path="query" type={`GroupByQueryProps`}>
  GroupBy query props

  <Expandable title="GroupByQueryProps">
    <ParamField
      path="dataPool"
      type={`{
id?: string;
name?: string;
}`}
    >
      Data pool to fetch columns from
    </ParamField>

    <ParamField path="accessToken" type={`string`}>
      Access token used for the query. While you can pass this one to each component, we recommend wrapping components in the `AccessTokenProvider` instead:
    </ParamField>

    <ParamField path="refetchInterval" type={`number`}>
      Interval in milliseconds for refetching the data
    </ParamField>

    <ParamField path="retry" type={`boolean`}>
      Whether to retry on errors.
    </ParamField>

    <ParamField path="propelApiUrl" type={`string`}>
      This prop allows you to override the URL for Propel's GraphQL API. You shouldn't need to set this unless you are testing.
    </ParamField>

    <ParamField path="enabled" type={`boolean`}>
      When false, the component will not make any GraphQL requests, default is true.
    </ParamField>
  </Expandable>
</ParamField>

<ParamField
  path="selectProps"
  type={`Omit<SelectProps<{
label: string;
value: string;
}>, "options" | "disableClearable">`}
>
  Props that the select input will receive
</ParamField>

<ParamField path="columns" type={`string[]`}>
  Columns to group by for static mode, if passed, the component will ignore the built-in GraphQL operations
</ParamField>

<ParamField path="loading" type={`boolean`}>
  When true, shows a skeleton loader
</ParamField>

<ParamField path="prettifyColumnNames" type={`boolean`}>
  If true, it will format camelCase and snake\_case column names to a readable format
</ParamField>

<ParamField path="nameFormatter" type={`(name: string) => string`}>
  Function to format column names
</ParamField>

<ParamField path="includeColumns" type={`string[]`}>
  Columns to include, if not passed, all columns will be included, pass `["*"]` to include all columns
</ParamField>

<ParamField path="maxGroupBy" type={`number`}>
  Maximum number of group by columns
</ParamField>

<ParamField path="defaultOpen" type={`boolean`}>
  If true, the dropdown will be open by default
</ParamField>

<Expandable title="Theme Provider Props">
  <ParamField path="appearance" type={`ThemeAppearances`}>
    The initial theme used as a base. It provides a default set of styling
    from which customizations can be applied.

    <Expandable title="ThemeAppearances">
      <ParamField path="ThemeAppearances" type={`"light" | "dark"`} />
    </Expandable>
  </ParamField>

  <ParamField path="accentColor" type={`AccentColors`}>
    The global theme accent color. This color is used to highlight elements

    <Expandable title="AccentColors">
      <ParamField path="AccentColors" type={`"amber" | "blue" | "bronze" | "brown" | "crimson" | "cyan" | "gold" | "grass" | "gray" | "green" | "indigo" | "iris" | "jade" | "lime" | "mint" | "orange" | "pink" | "plum" | "purple" | "red" | "ruby" | "sky" | "teal" | "tomato" | "violet" | "yellow"`} />
    </Expandable>
  </ParamField>

  <ParamField path="grayColor" type={`GrayColors`}>
    The global theme gray color. This color is used for text and background colors

    <Expandable title="GrayColors">
      <ParamField path="GrayColors" type={`"auto" | "gray" | "mauve" | "slate" | "sage" | "olive" | "sand"`} />
    </Expandable>
  </ParamField>

  <ParamField path="radius" type={`Radii`}>
    The global theme radius color. This color is used for border radius

    <Expandable title="Radii">
      <ParamField path="Radii" type={`"none" | "small" | "medium" | "large" | "full"`} />
    </Expandable>
  </ParamField>

  <ParamField path="scaling" type={`Scalings`}>
    The global theme scaling. This value is used to scale components

    <Expandable title="Scalings">
      <ParamField path="Scalings" type={`"90%" | "95%" | "100%" | "105%" | "110%"`} />
    </Expandable>
  </ParamField>

  <ParamField path="panelBackground" type={`PanelBackgrounds`}>
    The global theme panel background. This value is used to set the panel background

    <Expandable title="PanelBackgrounds">
      <ParamField path="PanelBackgrounds" type={`"solid" | "translucent"`} />
    </Expandable>
  </ParamField>
</Expandable>
