A liquid cartridge (30, 230) configured to be inserted into a case of a liquid-consuming device in a frontward direction intersecting a gravitational direction and attached to the case in an attached state, the liquid cartridge (30, 230) storing liquid therein and comprising: a front surface facing frontward in the frontward direction in the attached state of the liquid cartridge (30, 230); a rear surface spaced apart from the front surface in the frontward direction in the attached state of the liquid cartridge (30, 230); an upper surface (39, 141, 251) disposed between the front surface and the rear surface, the upper surface (39, 141, 251) facing upward in the attached state of the liquid cartridge (30, 230); a liquid supply portion provided at the front surface and configured to supply the liquid to outside of the liquid cartridge (30, 230); a detection portion (58, 67) including a light-receiving portion (66, 67) configured to receive incident light thereon, the light-receiving portion (66, 67) being positioned upward relative to the upper surface (39, 141, 251) in the attached state of the liquid cartridge (30, 230), the detection portion (58, 67) being configured to change a state of the incident light depending on a state of the liquid cartridge (30, 230); an electrical interface disposed at the upper surface (39, 141, 251), the electrical interface being positioned frontward relative to the light-receiving portion (66, 67) in the attached state of the liquid cartridge (30, 230); and an engaging surface facing rearward and configured to be engaged with the case of the liquid-consuming device in the attached state of the liquid cartridge (30, 230) such that the engagement between the engaging surface and the case of the liquid-consuming device restricts the liquid cartridge (30, 230) in the attached state from moving rearward; characterised in that: the engaging surface is positioned frontward relative to the light-receiving portion (66, 67) in the attached state of the liquid cartridge (30, 230). a front surface facing frontward in the frontward direction in the attached state of the liquid cartridge (30, 230); a rear surface spaced apart from the front surface in the frontward direction in the attached state of the liquid cartridge (30, 230); an upper surface (39, 141, 251) disposed between the front surface and the rear surface, the upper surface (39, 141, 251) facing upward in the attached state of the liquid cartridge (30, 230); a liquid supply portion provided at the front surface and configured to supply the liquid to outside of the liquid cartridge (30, 230); a detection portion (58, 67) including a light-receiving portion (66, 67) configured to receive incident light thereon, the light-receiving portion (66, 67) being positioned upward relative to the upper surface (39, 141, 251) in the attached state of the liquid cartridge (30, 230), the detection portion (58, 67) being configured to change a state of the incident light depending on a state of the liquid cartridge (30, 230); an electrical interface disposed at the upper surface (39, 141, 251), the electrical interface being positioned frontward relative to the light-receiving portion (66, 67) in the attached state of the liquid cartridge (30, 230); and an engaging surface facing rearward and configured to be engaged with the case of the liquid-consuming device in the attached state of the liquid cartridge (30, 230) such that the engagement between the engaging surface and the case of the liquid-consuming device restricts the liquid cartridge (30, 230) in the attached state from moving rearward; characterised in that: the engaging surface is positioned frontward relative to the light-receiving portion (66, 67) in the attached state of the liquid cartridge (30, 230).