hypeserver / react-date-range

A React component for choosing dates and date ranges.
MIT License
2.59k stars 678 forks source link

Is it possible to change the font of range labels? #594

Closed joaobraganca555 closed 1 year ago

joaobraganca555 commented 1 year ago

Subject of the issue

Is it possible to change the font family of the range labels (Today, Yesterday, This Week, Last Week, This Month, Last Month)? Or put the font equal to the rest of the DateRangePicker?

Screenshot 2022-11-28 at 13 50 23

joaobraganca555 commented 1 year ago

Just override like that!

const useStyles = makeStyles((theme) => ({
  dateRangePickerFont: {
    fontFamily: theme.typography.fontFamily,
    '& .rdrStaticRangeLabel': {
      fontFamily: theme.typography.fontFamily
    }
  }
}));

<DateRangePicker
      className={classes.dateRangePickerFont}
      onChange={(item) => {
        setDates([item.selection]);
      }}
      showSelectionPreview
      moveRangeOnFirstSelection={false}
      months={2}
      ranges={dates}
      direction="horizontal"
      maxDate={new Date()}
      rangeColors={[theme.palette.primary.main]}
      />